iOS - 使用Chrome中的网址方案打开应用

时间:2021-09-26 22:10:24

I've read many many blogs and examples of how to open an app from an URL scheme (for example, this blog), and it seems to work great when I call my app from mobile safari. For instance, when I call testapp://some.data.here in mobile safari, it opens my testapp and I can parse out the some.data.here.

我已经阅读了许多博客和如何从URL方案(例如,这个博客)打开应用程序的示例,当我从移动Safari中调用我的应用程序时,它看起来效果很好。例如,当我在移动safari中调用testapp://some.data.here时,它会打开我的testapp并且我可以解析some.data.here。

However, when I call testapp://some.data.here in iOS-Chrome, it just googles the term instead of calling the app.

但是,当我在iOS-Chrome中调用testapp://some.data.here时,它只是搜索术语而不是调用应用程序。

Is there a way to have iOS Chrome recognize the URL as a registered app the way mobile safari does?

有没有办法让iOS Chrome像移动Safari一样将URL识别为注册应用程序?

When I google this topic, I see a lot of comments on how to open a url in chrome from an app, but not the other way around.

当我谷歌这个主题时,我看到很多关于如何从应用程序打开chrome的网址的评论,但不是相反。

Has anyone encountered this?

有没有人遇到过这个?

Thanks!

谢谢!

2 个解决方案

#1


3  

Due to the way that the Chrome app appears to be developed, it doesn't seem this is possible at present without a jailbreak (and even then, not easily). You should go bug the Google Chrome iOS team to fix this (e.g. try to open in all registered apps with URL schemes before googling). Sorry I couldn't be of more use, but there just doesn't seem to be an easy way around it.

由于Chrome应用程序的开发方式,目前似乎没有越狱(即便如此,也不容易)。你应该去谷歌Chrome iOS团队修复此问题(例如,在谷歌搜索之前尝试使用URL方案在所有已注册的应用程序中打开)。对不起,我没有更多的用处,但似乎并没有一个简单的方法。

#2


1  

There is a complex workaround, but you're probably not going to be too excited about building it as it involves hosting a web server to dynamically generate pages with the appropriate redirect. This is a over-simplified representation of what we built at Branch. This includes some code to get you started though the web server will require a bit of setup not described here.

有一个复杂的解决方法,但您可能不会太兴奋构建它,因为它涉及托管Web服务器以动态生成具有适当重定向的页面。这是我们在Branch建立的内容的过度简化表示。这包括一些代码可以帮助您入门,虽然Web服务器需要一些未在此处描述的设置。

  1. instead of testapp://some.data.here, you'll link to http://yoursite.com/hosted-redirect/some.data.here.

    而不是testapp://some.data.here,你将链接到http://yoursite.com/hosted-redirect/some.data.here。

  2. your server should listen at the route /hosted-redirect, grab some.data.here and build the following page (body here):

    你的服务器应该在route / hosted-redirect上监听,抓住some.data.here并构建以下页面(正文在这里):

code http://derrrick.com/*/code.png

代码http://derrrick.com/*/code.png

So your server will have to generate and respond with this page, filling in some.data.here, anytime http://yoursite.com/hosted-redirect/some.data.here is requested.

因此,您的服务器必须生成并响应此页面,填写some.data.here,随时请求http://yoursite.com/hosted-redirect/some.data.here。

A lightweight node app could do this with a single file.

轻量级节点应用程序可以使用单个文件执行此操作。

I just tested a static file for one of my apps and this definitely works.

我刚测试了一个我的应用程序的静态文件,这绝对有效。

#1


3  

Due to the way that the Chrome app appears to be developed, it doesn't seem this is possible at present without a jailbreak (and even then, not easily). You should go bug the Google Chrome iOS team to fix this (e.g. try to open in all registered apps with URL schemes before googling). Sorry I couldn't be of more use, but there just doesn't seem to be an easy way around it.

由于Chrome应用程序的开发方式,目前似乎没有越狱(即便如此,也不容易)。你应该去谷歌Chrome iOS团队修复此问题(例如,在谷歌搜索之前尝试使用URL方案在所有已注册的应用程序中打开)。对不起,我没有更多的用处,但似乎并没有一个简单的方法。

#2


1  

There is a complex workaround, but you're probably not going to be too excited about building it as it involves hosting a web server to dynamically generate pages with the appropriate redirect. This is a over-simplified representation of what we built at Branch. This includes some code to get you started though the web server will require a bit of setup not described here.

有一个复杂的解决方法,但您可能不会太兴奋构建它,因为它涉及托管Web服务器以动态生成具有适当重定向的页面。这是我们在Branch建立的内容的过度简化表示。这包括一些代码可以帮助您入门,虽然Web服务器需要一些未在此处描述的设置。

  1. instead of testapp://some.data.here, you'll link to http://yoursite.com/hosted-redirect/some.data.here.

    而不是testapp://some.data.here,你将链接到http://yoursite.com/hosted-redirect/some.data.here。

  2. your server should listen at the route /hosted-redirect, grab some.data.here and build the following page (body here):

    你的服务器应该在route / hosted-redirect上监听,抓住some.data.here并构建以下页面(正文在这里):

code http://derrrick.com/*/code.png

代码http://derrrick.com/*/code.png

So your server will have to generate and respond with this page, filling in some.data.here, anytime http://yoursite.com/hosted-redirect/some.data.here is requested.

因此,您的服务器必须生成并响应此页面,填写some.data.here,随时请求http://yoursite.com/hosted-redirect/some.data.here。

A lightweight node app could do this with a single file.

轻量级节点应用程序可以使用单个文件执行此操作。

I just tested a static file for one of my apps and this definitely works.

我刚测试了一个我的应用程序的静态文件,这绝对有效。