我的浏览器后退按钮和我的 Jquery Mobile 应用程序一直有问题。
我试图将问题提炼成最简单的形式。我有一个页面,上面有一个按钮。我单击按钮,出现弹出窗口。弹出窗口上有一个指向谷歌的链接。我单击指向 google 的链接并且它有效,但是当我单击浏览器的后退按钮时,我看到该页面一秒钟,然后 google 再次加载。就像您在离开应用程序后就无法返回一样。
此问题不会发生在 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>
谢谢!
最佳答案
在链接中使用 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/>
关于javascript - JQuery Mobile - 链接到外部站点,无法使用浏览器后退按钮返回页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19419565/