曾遇到这样一个BUG,点击a标签,在安卓下,a标签链接不跳转,在iOS下会调起手机键盘。
其中安卓下点击a标签不跳转的解决办法,是不用href做跳转的链接,改为用JS控制跳转。
<a href="javascript:;" ontouchstart="window.location.href='/'">
<img src="xxx">
</a>
这样写虽然解决了安卓下点击a标签不跳转的问题,但还是没有解决点击a标签,在ios手机上会调出手机键盘的行为,不过将a标签换成div,就可以做到在iOS下不会再调出手机键盘了。
<div ontouchstart="window.location.href='/'">
<img src="xxx">
</div>