Puppuli
Puppuli

Reputation: 464

How to close google chrome using javascript?

Here I'm trying to close a single tab using javascript, but it doesn't work in chrome ver 38 (works fine in ver 28). But if I open a new window using javascript, then I can close this child window with javascript. I also need to close the parent window, please help me solve this issue. Below js code uses older version of chrome.

window.open('', '_self', ''); 
window.close();

And i'm not able to use any extension like 'close kiosk'. My company won't allow me to do such things.

Upvotes: 0

Views: 2937

Answers (1)

phantom13
phantom13

Reputation: 49

You could try using:

self.close();

It works in Chrome, Safari, IE but not sure about Firefox.

Also, there's a new way to close windows using the new method window.close() in the dev version of Chrome: see here. But I recommend using the first method as it currently works.

Upvotes: 1

Related Questions