简体   繁体   English

阻止带有重定向的iOS Web应用在移动Safari中打开链接

[英]Prevent iOS web app w/ redirect from opening link in mobile Safari

I'm currently developing a web app using HTML5, CSS3 and PHP that connects to Readmill's API with oAuth. 我目前正在开发使用HTML5,CSS3和PHP的网络应用,该应用通过oAuth连接到Readmill的API

I want the website to behave like a web app (“installed” on home screen) on iOS which leads to my problem: To authenticate users, my page has to redirect to Readmill's authentication page. 我希望网站的行为类似于iOS上的Web应用程序(“安装”在主屏幕上),这导致我的问题:要对用户进行身份验证,我的页面必须重定向到Readmill的身份验证页面。 This works flawlessly if the user has been logged in before using mobile safari and uses cookies—hence is still logged in and just has to tap on “Allow” on the “Grant access” page. 如果用户在使用移动浏览器和Cookie之前已登录,则此方法可以正常工作—因此,该用户仍处于登录状态,只需在“授权访问”页面上点击“允许”即可。

If the user isn't logged in, it gets redirected to the sign- up form which happens inside the app. 如果用户未登录,它将被重定向到应用程序内发生的注册表单 But if it then tries to sign in by tapping on “Sign in if you already have an account” the app opens the page in mobile Safari. 但是,如果然后尝试通过点击登录 “登录如果您已经有一个帐户”的应用程序打开的页面中移动Safari浏览器。

The sign-up/sign-in forms are part of Readmill's page so I cannot change how links behave—otherwise I would have tried changing its behaviour using jQuery or JavaScript. 注册/登录表单是Readmill页面的一部分,因此我无法更改链接的行为-否则,我将尝试使用jQuery或JavaScript更改其行为。

Is there any way to keep the user inside the app all the time except for having them log in in Safari prior to opening the web app? 除了让用户在打开Web应用程序之前登录Safari之外,是否可以一直将用户保留在应用程序中?

Adding this code worked for me: 添加此代码对我有用:

$('a').click(function() {
    window.location.href = this.href;
    return false;
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 完全阻止iOS Web应用程序打开移动Safari中的链接,即使包含参数的链接也是如此 - Completely prevent iOS web app from opening link in mobile Safari, even with links containing parameters 防止 IOS/Safari 从链接打开应用程序 - Prevent IOS/Safari From Opening App From Link 从移动浏览器(iOS 上的 Safari、Chrome)中的 Flutter Web 应用程序重定向到移动应用程序 - Redirect from Flutter Web App in Mobile Browser(Safari, Chrome on iOS) to Mobile App 阻止重定向到Deeplink的重定向链接打开移动浏览器 - Prevent redirect link to deeplink from opening mobile browser iOS 9 Web应用阻止链接在移动Safari中打开 - iOS 9 web app prevent links to open in mobile safari 从ios框架启动应用程序或在野生动物园中打开链接 - launching app or opening link in safari from ios framework AppStore拒绝打开移动Safari的iOS应用 - iOS app rejected by AppStore for opening mobile Safari Rails:redirect_to'myapp://'从移动safari调用iOS应用程序 - Rails: redirect_to 'myapp://' to call iOS app from mobile safari 如何从Mobile Safari重定向到Native iOS应用程序(如Quora)? - How to redirect from Mobile Safari to Native iOS app (like Quora)? 在 safari mobile 中从控制台打开链接 - Opening a link from the console in the safari mobile
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM