问题
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