简体   繁体   English

在html中为iPhone上的书签选项指定一个URL

[英]Specify an url in html for the bookmark option on the iPhone

I am building an iPhone optimized website and when people use the '+' button on the iPhone you can add a bookmark to the website on the homescreen of the iPhone. 我正在构建一个iPhone优化网站,当人们使用iPhone上的“+”按钮时,您可以在iPhone的主屏幕上为网站添加书签。 How can I specify a url that will be used instead of the page they are on. 如何指定将使用的URL而不是它们所在的页面。

For example, if they are in the /Foo/Bar url I want the bookmark to be /Home so they go automatic to the home url and not go from their homescreen button straight deep in the site. 例如,如果它们位于/ Foo / Bar url中,我希望书签为/ Home,这样它们就会自动转到主页面,而不是从主屏幕按钮直接进入网站。

Is there some way to achieve this, in stead of making the whole website ajax based so there is only 1 url. 有没有办法实现这一点,而不是使整个网站基于ajax,所以只有1个网址。

您可以在页面加载时更新要保存的任何页面的window.history记录(可能是您的所有页面)。

window.history.replaceState( '', '', '/Home' );

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM