Hello, Thank you for your time.

I know it is possible to create an exit button using javascript but this only work in ie browsers and not what i want(i found a fix for it but isnt very good), can somebody please show me a better way of closing all types of browsers(Chrome, Mozilla, Internet Explorer).

Thanks

Recommended Answers

All 7 Replies

This works in IE, FF, and Chrome...

<input type="button" value="Close Window" onclick="window.close()">

This works in IE, FF, and Chrome...

<input type="button" value="Close Window" onclick="window.close()">

So this should work.....

<input type="button" style="float:left;width:100px;" value="Exit" onclick="window.close();"/></p>

but does not work for me. How did you make it work and close a chrome browser because no matter how many times i click that button it will not close chrome or Mozilla, but in ie it will close with one click.

i tried this aswell window.opener = self;

Meh, well it only works apparently when that window was opened by another window. It won't work if the window was opened any other way I guess.

so its not possible to close chrome and firefox with the click of a button? i dont want to use the top right exit button i want to hide the tool bar for an app and have a exit button that users can click on a scanner and close the page without seeing the toolbar for web restricted access on the portable device.

It doesn't seem to be possible, and frankly it shouldn't be. It doesn't really make sense to take away the users default way of closing the browser.

Regards
Arkinder

can somebody try and explain to me why this isn't possible or why its not allowed. whats the difference if i create a button that basically does the same thing as the default close button but i want it somewhere else, this seems restricting for what reasons.

Hi.
Thank you so much for this code
I'll use of this code for my commercial project.
thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.