简体   繁体   English

如何处理IOS Web应用程序中的空锚

[英]How to handle empty anchors in a IOS webapp

I have transformed a website into an IOS webapp, works perfect, but the only thing is that if I press a empty anchor (see code below) the page goes to the top or bottom of the page, this only happens in the webapp, and not if I use safari on the iPad. 我已经将网站转换为IOS Webapp,可以完美运行,但是唯一的事情是,如果我按下一个空的锚点(请参见下面的代码),则该页面将转到页面的顶部或底部,这只会在webapp中发生,并且如果我在iPad上使用野生动物园,则不会。 I cant replace all empty links so is there an solution for this? 无法替换所有空链接,因此有解决方案吗?

basic link 基本连结

<a href="#">some link</a>

code that will work is 将起作用的代码是

<a href="javascript:void(0)">works</a>

EDIT: found the issue, if you are using an IOS webapp if will open new links in safari, therefor i used the prevent script from the mobile boilerplate https://github.com/h5bp/mobile-boilerplate . 编辑:发现了问题,如果您正在使用IOS Web应用程序,如果将在Safari中打开新链接,因此我使用了来自移动样板https://github.com/h5bp/mobile-boilerplate的阻止脚本。

<a href="javascript:void(0)" onclick="return false" > may it works</a> 

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

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