Solve the problem that the browser url does not change after the spring jquery Mobile page jumps && javaScript code is refreshed

When I was working on a remote control project recently, I used JqueryMoile and found a problem:
when I used the following tags, I found:

<a href="webDevices" >Device List</a>
After the jump, I found that the browser's url has not changed.

I only found out that when the javascript code I wrote in a web page loads the web page for the first time, the javascript code is not executed.

 

Anyway, it took a lot of time to locate the problem in the middle. It is also due to the new contact with such technology, which is not very precise. Later, I thought about it and restored it. I went back to the starting point and looked at the link of jquerymobile. There is such a paragraph:

    Jquery Mobile supports all standard html formats. In order to make the experience smoother, Jquery Mobile will automatically convert all links to pages in the same domain to ajax requests, and use animation transition effects to achieve switching
Links to other domains or links with rel="external", data-ajax="false" attributes and links with target attribute will not be loaded through ajax, and the page will be refreshed as a whole.
In this regard, I have considered whether it is because chrome uses ajax loading to improve the loading speed of the page, and the page will not be refreshed as a whole. So I added data-ajax="false" to the button, and it worked.
The correct way is as follows:
<a href="webDevices" data-ajax="false">Device List</a>

After changing to this way, all the problems are solved.


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325964572&siteId=291194637