web-open-app icon indicating copy to clipboard operation
web-open-app copied to clipboard

Cannot go to app store when application was not installed in safari browser !!!

Open nhanhaloli opened this issue 4 years ago • 9 comments

It worked well on Chrome, but when i tried this in safari browser, it always show popup "safari cannot open the page because the address is invalid" and stop there, i want browser to redirect to app store in this case. Really nend help. (Sorry because my english skill is not good)

nhanhaloli avatar Oct 30 '20 09:10 nhanhaloli

@nhanhaloli Is the scheme url or universal link url configured in safari?

luojinghui avatar Nov 03 '20 03:11 luojinghui

@nhanhaloli Is the scheme url or universal link url configured in safari?

it's the scheme url

nhanhaloli avatar Nov 03 '20 05:11 nhanhaloli

  1. I tested the safari browser on mac and ios without installing the app, and I can successfully detect whether the app is installed,and there are no error popups.

Later, if it is detected that the app is not installed, you can manually redirect to the page where the app is installed through the failed callback.

        const openapp = new OpenApp({
          scheme: "xylink://openapp",
          applink: "",
          copyText: "number: " + Math.ceil(Math.random() * 10000),
          callback: function (status, msg) {
            console.log("status: ", status, "  msg2: ", msg);
            // Redirect according to this status
          }
        })

        document.getElementById("openapp").addEventListener("click", function () {
          openapp.open();
        })

mac safari: image

mac chrome: image

ios chrome: image

ios safair: image

  1. If you want accurate detection and redirection effect, you can use ios universal link, its effect will be more reliable.

luojinghui avatar Nov 04 '20 03:11 luojinghui

  1. I tested the safari browser on mac and ios without installing the app, and I can successfully detect whether the app is installed,and there are no error popups.

Later, if it is detected that the app is not installed, you can manually redirect to the page where the app is installed through the failed callback.

        const openapp = new OpenApp({
          scheme: "xylink://openapp",
          applink: "",
          copyText: "number: " + Math.ceil(Math.random() * 10000),
          callback: function (status, msg) {
            console.log("status: ", status, "  msg2: ", msg);
            // Redirect according to this status
          }
        })

        document.getElementById("openapp").addEventListener("click", function () {
          openapp.open();
        })

mac safari: image

mac chrome: image

ios chrome: image

ios safair: image

  1. If you want accurate detection and redirection effect, you can use ios universal link, its effect will be more reliable.

Actully, the scheme url is not work

image

I am using react and this is my code

nhanhaloli avatar Nov 04 '20 03:11 nhanhaloli

As you can see, i want to open cashbag app, but it always go to app store anyway, if i tri to type "cashbag://" in address bar it will go to open app, i dont know why scheme is not work. Moreover, if i put string "cashbag://" into applink, it will show error like i talk above, i am using iphone 7 with safari browser, does it help

nhanhaloli avatar Nov 04 '20 03:11 nhanhaloli

@nhanhaloli

        openapp = new OpenApp({
          scheme: "xxx",
          applink: "",
          iosUseScheme: true,
          copyText: "number: " + Math.ceil(Math.random() * 10000),
          callback: function (status, msg) {
            console.log("status: ", status, "  msg: ", msg);
          }
        })

The default ios is to call the universal link to wake up the app,if you want to use the scheme to invoke the app, you need to configure:iosUseScheme: true,.

Test it, if the app is not installed, using the scheme will indeed show a link that cannot be opened in safari. This is unavoidable, unless the universal link on ios/pad can solve this problem

luojinghui avatar Nov 04 '20 04:11 luojinghui

@luojinghui Thank for your feedback.

What i need is:

  • If the app was installed -> go to app via scheme link.
  • if the app was not installed -> safari show popup not invalid -> close popup will call your callback function (if it do not show popup is the best case).

-> But now, when i closed popup, it stop there but not call your calback function (still in safari). How can i do it ??? Many thank for your help !!!

nhanhaloli avatar Nov 04 '20 06:11 nhanhaloli

我也遇到同样的问题,有什么办法解决吗

315zuicai avatar May 26 '23 10:05 315zuicai

@315zuicai iOS/iPad/Mac下,Safari浏览器可以通过universal link的形式解决,这种方式现在也是微信的换起app的方式,能够兼容safari和ios微信浏览器,适用性很强

luojinghui avatar Jun 06 '23 07:06 luojinghui