Jquery手机:在加载前重定向到另一个页面

我使用 jquery mobile 1.0

我想从first.html重定向到otherPage.html,而不显示first.html的内容

$("#pageId").live("pagebeforecreate",function(event) {                 

  window.location.href = "otherPage.html";              

});

-i尝试了几乎每一个事件,但不成功. first.html显示了一会儿.

然后,我尝试使用’pagebeforeload’事件,但它没有触发

$( document ).bind( "pagebeforeload",function( e,data ){ 

        console.log("pagebeforeload starting"); // NO LOGGING HAPPENING 
        window.location.href = "otherPage.html";

        e.preventDefault(); 

        data.deferred.resolve( data.absUrl,data.options,response.page); 

}); 

$( document ).bind( "pageload",data ){
    console.log("Page successfully loaded into DOM..."); // NO LOGGING HAPPENING 
});

– 这个事件不太清楚没有找到可行的例子.
– 任何人都可以帮忙!

解决方法

尝试这一个
$("#firstPageId").live("pagecreate",function(){
         $.mobile.changePage("otherPage.html");
});

另外,您可以使用loadPage

希望它有帮助:)

相关文章

页面搜索关键词突出 // 页面搜索关键词突出 $(function () {...
jQuery实时显示日期、时间 html: <span id=&quot...
jQuery 添加水印 <script src="../../../.....
中文:Sys.WebForms.PageRequestManagerParserErrorExceptio...
1. 用Response.Write方法 代码如下: Response.Write(&q...
Jquery实现按钮点击遮罩加载,处理完后恢复 思路: 1.点击按...