JQuery 移动版 - 链接到外部站点,无法使用浏览器后退按钮返回页面

JQuery Mobile - Link to External Site, can't go back to page with browser back button

本文关键字:浏览器 按钮 返回 移动 链接 站点 外部 JQuery      更新时间:2023-09-26

我一直在使用浏览器后退按钮和我的 Jquery 移动应用程序时遇到问题。

我试图将问题提炼成最简单的形式。 我有一个带有按钮的页面。 我单击按钮,弹出窗口出现。 弹出窗口有一个指向谷歌的链接。 我点击谷歌的链接,它可以工作,但是当我点击浏览器后退按钮时,我看到页面一秒钟,然后谷歌再次加载。 就像离开应用程序后您根本无法回去一样。

在 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="answerswer-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> 

谢谢!

在链接中放入data-history="true"而不是false

<a class="advisor_button" id="answerswer-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/>