在使用haslink (#testhash)时,Safari不起作用。我真的找不到这个问题。下面是我提供的以下代码
<a href="?page_id=112#testhash">Click here to go to Hash</a>
<div style="height:500px"> </div>
<div id="testhash"></div>
<div>............Test Data............</div>当我点击这个链接时,它会在Safari上找到合适的位置,但是它在Google、Mozila和IE9上运行得很好。在Safari中,链接是在http://example.com/重写后重定向到站点http://example.com/#testhash的。有趣的是,当我直接将链接http://example.com/#testhash放在Safari的地址栏上时,它工作得很好,但是单击它的时间不起作用,而且当我写http://example.com/?page_id=112#testhash时,它也出现了问题。
发布于 2013-07-26 10:46:09
你可以做一件事。提供完整的链接而不是?page_id,因为有时候Safari或其他浏览器为Wordpress编写不同的重写规则,这就是为什么Hashlink不能工作的原因。你可以把
<a href="http://testwordpress.com/[*rewritten Page By Browser]/#testhash">Click here to go to Hash</a>而不是<a href="?page_id=112#testhash">Click here to go to Hash</a>,它可能会工作。
*我的意思是重写页面,因为浏览器通过父母和孩子(如about-us/page/etc )将页面分隔开来,所以url应该来自我的示例http://testwordpress.com/about-us/page/etc/#testhash
发布于 2013-07-25 04:57:59
您能否将href更改为"#testhash“,看看它是否解决了您的问题?
编辑我的答案,因为还不清楚:
试试这个:
<a href="#testhash">Click here to go to Hash</a>
<div style="height:1200px"> </div>
<a name="testhash" />
<div id="testhash"></div>https://stackoverflow.com/questions/17849034
复制相似问题