jquery-archive / jquery-mobile

jQuery Mobile Framework
https://jquerymobile.com
Other
9.68k stars 2.4k forks source link

the jquerymobile tabs widget load twice by ajax #8591

Open riniky opened 7 years ago

riniky commented 7 years ago

I made a simple test on jquerymobile tabs, but it loads twice, here is content:

Page 1:

<!DOCTYPE html><html><head>
<link rel='stylesheet' href='theme-classic.css'/>
<script src='jquery-2.1.4.min.js'></script>
<script src='jquery.mobile-1.4.5.min.js'></script>
</head><body><div data-role="page"><div data-role="content">

<a href="a2.asp">test</a>

</div></div></body></html>`

Page 2:

<!DOCTYPE html><html><head>
<link rel='stylesheet' href='theme-classic.css'/>
<script src='jquery-2.1.4.min.js'></script>
<script src='jquery.mobile-1.4.5.min.js'></script>
</head><body><div data-role="page"><div data-role="content">

<div data-role="tabs">
<div data-role="navbar"><ul>
<li><a href="#A" class="ui-link ui-btn ui-tabs-anchor ui-btn-active">A</a></li>
<li><a href="#B" class="ui-link ui-btn ui-tabs-anchor">B</a></li>
</ul></div>
<div id="A" class="ui-body-d ui-content">A</div>
<div id="B" class="ui-body-d ui-content">B</div>
</div>

</div></div></body></html>

=======================================

if i visit page 2 directly, or visit without ajax, it works fine...

but if i visit page 2 from the link in page 1 (the page 2 will be open in a ajax way), I will see two times ajax request (F12 developer tool in Chrome), and the page 2 will not display correctly.

any clue, please?