您的位置:首页 > Web前端 > JQuery

关于JQueryMobile 连接到自定义的外部html页面的Error Loading Page问题的解决

2014-04-03 16:31 281 查看


关于JQueryMobile的Error Loading Page问题的解决

默认情况JQUERY MOBILE会捕获对链接点击的事件,试图通过AJAX的方式载入目标页面。但如果目标页面是302重定向的方式,则会弹出Error Loading Page的错误。

折腾了很久,也尝试通过

$(document).bind("mobileinit", function(){

$.mobile.ajaxEnabled=false;

});

来禁止之,但一直无效。

最后找到一段话:

To disable pages loading through Ajax bind 'mobileinit' and override $.mobile.ajaxEnabled (You need to bind 'mobileinit' before referencing the jQuery mobile script) or add data-ajax="false" or rel="external" to
the link element.

添加了之后一切OK。

<a href="gonggao.html" rel="external"> 公告</a> 从首页home.html连接到gonggao.html

参考:
http://jquery-ui-map.googlecode.com/svn/trunk/demos/jquery-mobile-example.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐