0

Is there a way to prevent my site from being opened inside a UIWebView of any iOS or Android app, such as formatting the URL in a special way? These are apps that I do not own, so the call is coming from my page, not from the app.

Preferably, when an app tries to open the page on my site from within the UIWebView, it would automatically open up the page in the Safari or native browser app instead of inside the users application.

Otherwise, it looks like I would have to run some javascript to determine if the page is opened inside of a UIWebView and then just restrict access.

4

2 回答 2

2

不,浏览器只是一个应用程序。使用 webview 的浏览器应用程序和另一个应用程序之间没有具体区别。用于 javascript 浏览器检测的链接对于这种情况几乎没有用处。应用程序可以将其用户代理设置为他们想要的任何内容,包括与本机浏览器应用程序使用的用户代理相同的用户代理。基本上,您尝试用来检测默认浏览器的任何东西都可以被另一个应用程序模仿。

于 2013-03-11T20:33:20.227 回答
-1

您可以将自己应用程序中的用户代理更改为您可以使用 javascript 检测到的特定内容。

您还可以从您的 iOS 代码调用 webview 中的 javascript 函数,这样您就可以等待显示内容,直到该调用来自您的应用程序。

虽然这些东西很容易被模仿,并且不会阻止忽略 javascript 的爬虫,但不太可能有人会经历所有的麻烦。如果您想要进一步的保护,您将不得不引入某种形式的身份验证。

于 2013-03-29T22:16:01.890 回答