I have question. For example, using jquery I open site. The code location.href = "https://somesite.com";
. Can I delete some element from site or add some element to site from script after this code location.href = "https://somesite.com";
after redirect?
Asked
Active
Viewed 42 times
-2

oleh
- 1
-
dupes:http://stackoverflow.com/questions/18048338/how-can-i-execute-a-script-after-calling-window-location-href | http://stackoverflow.com/questions/37716183/execute-a-function-after-changing-location-href – lukkea Feb 16 '17 at 13:12
-
Possible duplicate of [Execute a function after changing location.href](http://stackoverflow.com/questions/37716183/execute-a-function-after-changing-location-href) – lukkea Feb 16 '17 at 13:12
-
2Possible duplicate of [How can I execute a script after calling window.location.href?](http://stackoverflow.com/questions/18048338/how-can-i-execute-a-script-after-calling-window-location-href) – Finwe Feb 16 '17 at 15:30
1 Answers
-2
No. When the browser left the page using location.href = 'XYZ'
your code is unloaded at all. Also, the same-origin policy should prevent what you want to do.
You could write a plugin for your web browser to achieve your goal.

Thomas Kekeisen
- 4,355
- 4
- 35
- 54
-
-1 - this is an obvious dupe; try not to encourage this by answering. You haven't really given an answer to the question other than saying "no". You have left "enter link description here" as the link text. – lukkea Feb 16 '17 at 13:14
-