JS: the functionality of the window.location.replace() for Opera?

0 like 0 dislike
3 views
In all browsers except Opera, window.location.replace() replaces the url is fine without making an entry in the history of the browser (in my case I need to change the hash, e.g. "#1").

If there any way to change url in Opera without making an entry in the history of the browser?


The point is that there is a gallery of images, the transition between images is changing the hash (which you could give someone a link and they got the same image that was open when you copy the address). If the visitor will wander through the gallery and click "back" in all browsers except Opera, he gets on the previous page, and in Opera on the same page with the previous picture. How to avoid it?
by | 3 views

1 Answer

0 like 0 dislike
Yes, in the Opera window.location.the replace method is not working as it should. If we change the url with page reload, then all is well. For example:
\r
visit site1.com
go site2.com
javascript: window.location.replace('?q=1')
go back // to the user site1.com
\r

\r
But hash also needed a room, but no solution was never found, except in one place:
\r
    \r
  • make url hash polling(200ms)
  • \r
  • fix moving images in the gallery
  • \r
  • if I noticed that the url changed to the previous one, and thus we have not detected this change, it means the user pressed the back button in the browser
  • \r
  • the called method history.go(-N), where N is the number of clicks on pictures in gallery + 1, therefore, the user will be on the necessary page of our website.
  • \r

But I quickly abandoned that solution, focusing on the polling and just showing the previous picture. This way we retain the more convenient navigation through the gallery.
by

Related questions

0 like 0 dislike
7 answers
asked Mar 23, 2019 by lampa
0 like 0 dislike
2 answers
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
110,608 questions
257,186 answers
0 comments
32,851 users