In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly shows you "how to achieve ajax fallback", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "how to achieve ajax fallback" this article.
First, use iframe to generate history through [xss_clean]
The code is as follows:
0
0
Var info = document.getElementById ('info')
Var I = 1
Function add () {
Info [XSS _ clean] = I
Document.title = I
Var data = {
Param: i
Func: func
}
History.push (data)
ITunes +
}
History.push ({param:0, func: func})
Function func (I) {
Info [XSS _ clean] = I
Document.title = I
}
There is one more blank.html than the previous article, which is an empty html shelf with no JS logic code, as follows
The copy code is as follows:
Blank.html
Each ajax operation appends a number to the question mark of the iframe.src to record history. Click the back button, get the url of iframe in the onload event of iframe, and fetch the record according to the number after the question mark.
All browsers support this method. The disadvantage is that if there is another iframe in the main page and its src is modified. History management can be chaotic.
Third, using iframe, the history is generated by modifying iframe.src, and the callback is written in the html page corresponding to iframe
The copy code is as follows:
0
0
Var info = document.getElementById ('info')
Var I = 1
Function add () {
Var data = {
Param: i
Func: func
}
History.push (data)
ITunes +
}
History.push ({param:0, func: func})
Function func (I) {
Info [XSS _ clean] = I
Document.title = I
}
Each ajax operation to change the value of location.hash, each change will be reflected in the address bar. Listen for the event in _ window.onhashchange. The corresponding history is taken by the value of hash.
The advantage over iframe is that you can copy the url of the address bar to enter the history directly, but the disadvantage is that IE6/7 does not support it.
The above is all the contents of the article "how to back off ajax". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.