Mint
Mint

Reputation: 15927

javascript:window.close(); doesn't close the tab in IE 8

It works in Chrome and I thought it used to work in IE8... but it doesn't seem to.

javascript:window.open('', '_self', ''); window.close();alert('test');

All I get is the alert.

Basically i'm trying to execute a function which works fine in the browser as an a link, but using the same code in captivates "execute javascript" on a button, doesn't work.

Then I thought I would test it using javascript: in IE... and it doesn't close it ether.

Whats going on?
It's driving me nuts.

Upvotes: 2

Views: 20727

Answers (3)

S.H.Kashani
S.H.Kashani

Reputation: 11

A better presentation:

onclick="javascript: window.open('', '_self', ''); window.close();"

Upvotes: -2

Ziggler
Ziggler

Reputation: 3500

I don't know why, but the example from the link below didn't work for me.

http://www.w3schools.com/jsref/met_win_close.asp

Worked:

window.close();

Didn't worked:

myWindow.close();

Upvotes: 0

Mint
Mint

Reputation: 15927

I found that this works

top.close();

From within the browser address bar

javascript:top.close();

Upvotes: 3

Related Questions