Nazariy M
Nazariy M

Reputation: 3

window.open is not a function error, Please help. I have looked everywhere, cant understand

link to video: https://www.youtube.com/watch?v=MY1JKlJj7aY

<a href="javascript://" onclick="window.open('/index/11','upp','scrollbars=1,top=0,left=0,resizable=1,width=680,height=350');return false;" rel="nofollow" class="profile-settings" title="Hастройки"></a>

Website: http://tmptstdays4god.ucoz.com/load/test_1/zavet_music/2-1-0-11

Upvotes: 0

Views: 3882

Answers (2)

Andreas Louv
Andreas Louv

Reputation: 47109

If you have overwritten the window property you can ether call open on its own or get the global context using the following trick (doesn't work for strict mode):

new Function('return this;')().open('/index/11','upp','scrollbars=1,top=0,left=0,resizable=1,width=680,height=350');

You can also refer to window as self or (parent and top if you are not in a frame):

console.log(window === self); // true
console.log(window === parent); // true if no frames
console.log(window === top); // true if no frames

Upvotes: 2

S. Brentson
S. Brentson

Reputation: 454

It appears that you have assigned some value to window.open someplace in your script. Look for code upstream that may have done this accidentally.

This reproduces your problem:

window.open = "no such function";
window.open('/index/11','upp','scrollbars=1,top=0,left=0,resizable=1,width=680,height=350');

https://jsfiddle.net/9aktx53g/

Upvotes: 0

Related Questions