Click here to Skip to main content
15,892,059 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
If page has window.open function. That page is used in multiple website. In a mobile version of it. That particular page need a J Query script that will prohibit or intercept any window.open methods from executing.
Posted
Comments
CHill60 22-Oct-14 9:34am    
What have you tried? What isn't working?

1 solution

window object does not provide any event like before-open (or other open-related events), so you can not intercept it...
The only known - to me - solution is to override window.open function...
JavaScript
window.open_original = window.open;

window.open = function(url, name, features, replace) {
    alert("!");

    window.open_original(url, name, features, replace);
}

window.open("http://www.codeproject.com");
http://jsfiddle.net/5fLkb2zx/[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900