梦想杀死 发表于 2017-9-20 22:05:56

jquery 没先引入把

scarlett 发表于 2017-11-29 11:39:14


在别的网页上也遇到这种问题。

终于解决了,在a 标签上添加 external就可以了

<a rel="external" href=“”>

scarlett 发表于 2017-11-29 11:41:19

本文最初的问题解决方案是将script写在 window.onload中。

但是又在其它页面遇到了同样的js刷新后才执行的问题,解决办法是在a标签上加上 external。

myerwang 发表于 2017-11-30 14:21:39

scarlett 发表于 2017-11-29 11:41
本文最初的问题解决方案是将script写在 window.onload中。

但是又在其它页面遇到了同样的js刷新后才执行的 ...

解决方案太奇怪了。估计会有很多兼容问题和安全问题。
应该直接用php解决到问题。

scarlett 发表于 2018-1-21 08:57:19

Linking within a multi-page document
A single HTML document can contain one or many "page" containers simply by stacking multiple divs with a data-role of "page". This allows you to build a small site or application within a single HTML document; jQuery Mobile will simply display the first "page" it finds in the source order when the page loads.

If a link in a multi-page document points to an anchor (#foo), the framework will look for a page wrapper with that id (id="foo"). If it finds a page in the HTML document, it will transition the new page into view. You can seamlessly navigate between local, internal "pages" and external pages in jQuery Mobile. Both will look the same to the end user except that external pages will display the Ajax spinner while loading. In either situation, jQuery Mobile updates the page's URL hash to enable Back button support, deep-linking and bookmarking.

It's important to note that if you are linking from a mobile page that was loaded via Ajax to a page that contains multiple internal pages, you need to add a rel="external" or data-ajax="false" to the link. This tells the framework to do a full page reload to clear out the Ajax hash in the URL. This is critical because Ajax pages use the hash (#) to track the Ajax history, while multiple internal pages use the hash to indicate internal pages so there will be conflicts in the hash between these two modes.

For example, a link to a page containing multiple internal pages would look like this:

<a href="multipage.html" rel="external">Multi-page link</a>

scarlett 发表于 2018-1-21 08:58:01

<a data-ajax="false" >这样也可以
页: 1 [2]
查看完整版本: javascript 不执行,刷新后才执行