iOS 主屏幕书签 - 避免被拉出到 mobileSafari?

发布于 2024-12-05 02:20:17 字数 126 浏览 0 评论 0原文

我正在对移动网络应用程序进行最后的润色,我了解到,当您将页面添加到主屏幕时,单击任何链接都会使用户退出全屏模式并进入 mobileSafari,完全破坏了全屏模式的目的。 - 屏幕模式。当所有链接都迫使您退出全屏模式时,如何使用全屏模式?

I'm putting the finishing touches on a mobile web app and I learned that when you add a page to the home screen, clicking on any link will bring the user out of full-screen mode and into mobileSafari, completely destroying the purpose of full-screen mode. How does anyone make use of full-screen mode when all links force you out of it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

沉溺在你眼里的海 2024-12-12 02:20:17

单击的任何 链接实际上都会导航并定向到本机浏览器,从“应用程序”窗口弹出。所有导航都必须简化为脚本操作、显式导航浏览器或通过 AJAX 提交表单。

下面是一个更常见的 jQuery 替换实现,它还管理任何未来的文档修改和锚点添加:

$("body")
       .on("click","a", function () {
           var href = $(this).attr("href");
           if (href) {
               window.location = href;
               return false;
           }
           return true;
       });

顺便说一句,表单提交似乎工作得很好并且不会打开新窗口,因此不需要发生任何特殊情况。

我倾向于将其放入可拉入任何页面的启动脚本中。这要么是页面底部的纯脚本块,要么是 Angular 中的 app.run() 。

Any <a href=""> link that is clicked actually navigates and is directed into the native browser, popping out of the 'app' window. All navigation has to be mitigated to script operations, explicitly navigating the browser, or submitting forms via AJAX.

Here's a more common jQuery implementation for the replacement that also manages any future document modifications and anchor additions:

$("body")
       .on("click","a", function () {
           var href = $(this).attr("href");
           if (href) {
               window.location = href;
               return false;
           }
           return true;
       });

Incidentally form submissions appear to work just fine and do not open a new window, so nothing special needs to happen with that.

I tend to put that into startup script that gets pulled into any page. That's either plain script block at the bottom of the page, or something app.run() in Angular.

孤蝉 2024-12-12 02:20:17

我在博客上找到了这个评论:

A fast fix for an existing site (withprototype.js):

document.observe(“click”,function(event){
var element = event.findElement(“a”);
if(element.href){
event.stop();
location.href = element.href; //this does the trick, page will open in same window
return false;
}
});

来源:http://www.luscarpa.com/development/make-your-website-an-iphone-web-application/

I found this comment on a blog:

A quick fix for an existing site (with prototype.js):

document.observe(“click”,function(event){
var element = event.findElement(“a”);
if(element.href){
event.stop();
location.href = element.href; //this does the trick, page will open in same window
return false;
}
});

Source: http://www.luscarpa.com/development/make-your-website-an-iphone-web-application/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文