There is a JavaScript code that opens new page which tries to change the mother-page with the help of window.opener. I need to Protect mother-page from any change. Any advice on how to do it?
Code like this needs to be blocked
window.opener.location.href='http://google.com/';
No, you cannot stop executing "window.opener" but what you can do is assign the opener function to a different variable and mock the original one.
If some other script tries to execute window.opener, the new empty function is going to be called and nothing will happen.