In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "jquery how to achieve Wechat browser to prevent page drag", the content of the article is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "jquery how to achieve Wechat browser to stop page drag" bar!
Jquery implements the method of disabling browser fallback by first opening the corresponding js file, and then disabling the browser's back and next buttons through the "jQuery (document) .ready (function () {...}" method.
The operating environment of this tutorial: windows7 system, jquery1.10.0 version, thinkpad T480 computer.
Jquery disable browser back button
Use Jquery to disable the browser's back and next buttons:
Sometimes, in order to prevent users from getting out of order, they have to disable the forward and backward buttons of the browser jQuery (document) .ready (function () {
If (window.history & & window.history.pushState) {
$_ (window) .on ('popstate', function () {
/ / it will be triggered when the browser's back and forward buttons are clicked.
Window.history.pushState ('forward', null,'')
Window.history.forward (1)
})
}
/ / these two lines are required in IE.
Window.history.pushState ('forward', null,'')
Window.history.forward (1)
})
This code mainly uses the window.history object of js
For example:
If the url of the current page is:
Execute: window.history.pushState ('forward', null,' badu.aspx')
The result: adding a url to the browser history that records the current page becomes, but the page is not refreshed and the url is not checked for correctness. At this point, if you click the browser's back button, it will go back to the page, or the current page. So that's how the back button is disabled above.
Thank you for your reading, the above is the content of "jquery how to achieve Wechat browser to prevent page dragging". After the study of this article, I believe you have a deeper understanding of how jquery implements Wechat browser to prevent page dragging, and the specific use still needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
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.