Add a history record to the browser without changing the hash or any other parts of the URL

Is there a trick (with an iframe, maybe ...) to add a history entry to the browser without changing the hash or any other parts of the URL, being compatible with older browsers (not older than ie8 - without pushstate)?

I know this sounds strange, but here is the logic of this question:

I am making a one-page application and I want to get rid of the modals like pop-ups. I use the same methods, but instead of placing the div above the actual page, I would like to hide the entire page and show only the div representing the modal.

This works fine, but now that the modal takes up the whole page, the user tends (and quite normally) to click on the "Back" button to cancel the action and return to the previous page (which is hidden while the modal is).

I know that I can go to another page (by changing the hash), but I don’t want the URL to change, since the destination is not its own page, but only modal (it would be impractical to copy the modal URL and pass it to someone to another or modal bookmarks - like any normal modal inside a popup).

I will also need to delete this entry in cases where the user performed an action (in modal) or clicked the cancel button.

+4
source share
1 answer

I found an article that explains what might be the solution (with iframe ...): from Ajax Design Patterns book

I will give him a try in the near future and will lead you to the result.

0
source

Source: https://habr.com/ru/post/1482064/


All Articles