'rel=external' is not working trying to link to external site

浪子不回头ぞ 提交于 2019-12-12 05:11:17

问题


How can I link to an external site in jQuery from a button within the header bar ?

I have tried below but it is not working.

<div data-role="header" data-theme="b">
        <h4>Header</h4>
        <a rel='external' data-ajax="false" href='www.google.com' class='ui-btn-right' data-icon='arrow-l'>Google</a>
</div>

Fiddle :

http://jsfiddle.net/4Bgx7/1461/


回答1:


Prefixing http:// to the href would fix the issue.

<a data-rel='external' data-ajax="false" href='http://www.google.com' class='ui-btn-right' data-icon='arrow-l'>Google</a>

A demo here - http://jsfiddle.net/4Bgx7/1464/




回答2:


You need data-rel="external", not rel="external"

http://jquerymobile.com/demos/1.1.1/docs/api/data-attributes.html




回答3:


You can use data-ajax="false" on the link.

For example: <a href="http://www.example.com/path/to/page.html" data-ajax="false">link</a>



来源:https://stackoverflow.com/questions/11886945/rel-external-is-not-working-trying-to-link-to-external-site

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!