However, in some cases, you want to prevent it. How to do it?
Example: you are in a webpage with URL (https://mail.google.com/mail/u/0/#inbox)
F12 and go to tab Console to run this command:
You will redirect to website: http://google.com
But, if you freeze object location, you can prevent redirect
Now you can’t change location by using below methods.