You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="history.js"></script>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(function() {
// we get a normal Location object
/*
* Note, this is the only difference when using this library,
* because the object window.location cannot be overriden,
* so library the returns generated "location" object within
* an object window.history, so get it out of "history.location".
* For browsers supporting "history.pushState" get generated
* object "location" with the usual "window.location".
*/
var location = window.history.location || window.location;
// looking for all the links and hang on the event, all references in this document
$(document).on('click', 'a.ajax', function() {
// keep the link in the browser history
history.pushState(null, null, this.href);
// here can cause data loading, etc.
// do not give a default action
return false;
});
// hang on popstate event triggered by pressing back/forward in browser
$(window).on('popstate', function(e) {
// here can cause data loading, etc.
// just post
alert("We returned to the page with a link: " + location.href);
});
});
</script>
</head>
<body>
<a class="ajax" href="/mylink.html">My Link</a>
<a class="ajax" href="/otherlink.html">Other Link</a>
</body>
</html>
But the Titles are not change when click browser back button.
The text was updated successfully, but these errors were encountered:
All working fine but when i'm in page1 and the page title is title1 and when i click page2 and page two title is title2 so all working fine and pushState change the title properly. But the problem is in back button and i think in popstate event because when i'm in page two and when i back to page1 then the title not changing to title1, i mean title2 > title1 . I think u understand.
I follow this
But the Titles are not change when click browser back button.
The text was updated successfully, but these errors were encountered: