2013-10-17 22 views
3

我一直有问题与浏览器后退按钮和我的JQuery的移动应用程序。JQuery Mobile - 对外部网站的链接,无法返回到带有浏览器后退按钮的页面

我试图将问题提取到最简单的形式。我有一个页面上有一个按钮。我点击按钮,弹出窗口出现。弹出窗口有一个链接到它的谷歌。我点击链接到谷歌,它的工作原理,但当我点击浏览器后退按钮,我看到了第二页,然后谷歌再次加载。这就像你离开应用程序后根本无法回去。

在PC或Mac上不会发生此问题。它确实发生在iPhone和iPad上。

下面的代码:

<!DOCTYPE html> 
<html> 
    <head> 
    <title>wtf</title> 

    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css" /> 
    <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script> 
    <script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script> 


</head> 
<body> 
    <!-- Start of first page --> 
<div data-role="page" id="foo"> 
    <div data-role="content" id="content"> 
     <a href="#advisor4" data-rel="popup" data-role="button" data-close-btn="right" data-inline="true" data-transition="slidedown" > popup</a> 
    </div>  
    <div data-role="popup" id="advisor4" class="advisor popupPage ui-btn-right" data-dismissible="false" data-overlay-theme="e" data-theme="b" ><br/> 
     <a class="advisor_button" id="answer-4-26" href="http://google.com" data-history="false" data-ajax="false" rel="external" data-role="button" data-inline="true" data-theme="b" data-corners="false"> google data-history="false" data-ajax="false" rel="external" </a><br/> 
    </div> 
</div><!-- /page --> 
</body> 

谢谢!

+0

尝试添加data-history =“false”弹出并检查 –

+1

是否看起来像一个url问题。当弹出窗口打开时,它会向URL添加'#&ui-state = dialog'。我已经提出了一个可以在iphone 5 iso7上使用的解决方案,safari。尝试这里的代码http://jsfiddle.net/Palestinian/ZVhFW/ – Omar

+0

@omar乍一看你的解决方案似乎工作。我会接受它(或任何我应该做的事......对不起,这里是noob)你能向我解释为什么这是必要的吗?这是JQM的功能还是bug? –

回答

3

data-history="true"代替false放在链接中。

<a class="advisor_button" id="answer-4-26" href="http://google.com" data-history="false" data-ajax="false" rel="external" data-role="button" data-inline="true" data-theme="b" data-corners="false"> google data-history="true" data-ajax="false" rel="external" </a><br/> 
相关问题