Alter browser back button destination with jquery or html5 -


I have a customer who asked me to develop a page for my internal intranet / knowledgebase.

We have a link to another page (or multiple seconds page)

Page 1: When the user clicks on the link on page 1 A new window opens (page 2). In fact, Page 1 is reloaded and the page 1 is refreshed and the knowledge loads the base article - effectively a pop-underscore. Where the knowledge base article is loaded with original page content based on basic knowledge (as well as knowledgeable articles in separate tabs)

So far, I have a work solution but the man wants me to do this work so that the new window (page 2) will work back button. At the moment, Page 2 is a new tab, so it has no history (but users see it as the original page).

So the question is - is there any way to give a new tab to any history

= "text">

I got the solution:

The first time when I open a new window, I mean string? Prevpage = I pass a variable in http: /www.site.com. / Page.html

Next to the new page I add:

  & lt; Script & gt; Window.history.pushState ({}, '', '& lt ;? php echo $ prevpage;; & gt;'); & Lt; / Script & gt;  

which puts the previous page in the history of the new window (back button).

Then I place it at the bottom of the page which uses the popstate to go back to the original page url when the back button is clicked:

  & Lt; Script & gt; Window.addEventListener ("popstate", function (e) {window.location = "& lt ;? php echo $ prevpage;;>";;}); & Lt; / Script & gt;  

Comments