6 examples of 'browser back button event jquery' in JavaScript

Every line of 'browser back button event jquery' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
270window.addEventListener('keyup', function goBack(event) {
271 if (document.location.hash != '#root' &&
272 event.keyCode === event.DOM_VK_ESCAPE) {
273
274 event.preventDefault();
275 event.stopPropagation();
276
277 document.location.hash = 'root';
278 }
279});
283function nav_back_handler(e){
284 w.close();
285}
13function backToPreviousPage(e) {
14 window.history.back();
15}
95function addBackButtonListener(backButton) {
96 new FastButton(backButton, function (e) {
97 e.preventDefault();
98 var options = this.getAttribute("data-page-options");
99 var effect = this.getAttribute("data-transition-effect");
100 var dataBack = backButton.getAttribute("data-back");
101 if (dataBack !== "") {
102 var dataBackAsInt = parseInt(dataBack);
103 that.options = options;
104 that.transitionEffect = effect;
105 that.backLinkPressed = true;
106 history.go(dataBackAsInt);
107 }
108 });
109}
133$(document).on('click', 'a[href]:not([data-bypass])', function click(evt) {
134 if (evt.which > 1 || evt.shiftKey || evt.altKey || evt.metaKey) {
135 return;
136 }
137 // Get the absolute anchor href.
138 console.log("anchor link clicked");
139 var href = $(this).prop("href");
140 // Get the absolute root.
141 var root = location.protocol + "//" + location.host + '/';
142 // Ensure the root is part of the anchor href, meaning it's relative.
143 if (href && href.slice(0, root.length) === root) {
144 // Stop the default event to ensure the link will not cause a page
145 // refresh.
146 evt.preventDefault();
147 // `Backbone.history.navigate` is sufficient for all Routers and will
148 // trigger the correct events. The Router's internal `navigate` method
149 // calls this anyways. The fragment is sliced from the root.
150 Backbone.history.navigate(href.slice(root.length), {trigger: true});
151 }
152});
57function getBackButton() {
58 return document.getElementById("button-back");
59}

Related snippets