# Closing a browser

**URL:** https://discussions.unity.com/t/closing-a-browser/33239
**Category:** Questions & Answers
**Created:** [December 17, 2011, 11:29pm UTC](https://discussions.unity.com/t/closing-a-browser/33239 "2011-12-17T23:29:54Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![anon16049781](https://avatars.discourse-cdn.com/v4/letter/a/958977/32.png) [@anon16049781](https://discussions.unity.com/u/anon16049781)
#### Post date: [December 17, 2011, 11:29pm UTC](https://discussions.unity.com/t/closing-a-browser/33239/1 "2011-12-17T23:29:54Z")

</div>

Hi.

I’m making an online game. I want to have a quit button on the main menu so that if the player clicks it the browser window be closed. Could you please help me and give the code for it?

I used this one, but it didn’t do anything.

var isQuitButton = false;

function OnMouseUp()

{

if(isQuitButton)

{

```
 Application.Quit();

```

}  
…  
}

Thanks for help.

---

<div class="post-metadata">

### Author: ![Bunny83](https://avatars.discourse-cdn.com/v4/letter/b/96bed5/32.png) [@Bunny83](https://discussions.unity.com/u/Bunny83)
#### Post date: [December 18, 2011, 12:16am UTC](https://discussions.unity.com/t/closing-a-browser/33239/2 "2011-12-18T00:16:16Z")

</div>

That can’t be enforced by the UnityWebplayer. Usually people uses tabs nowadays, so closing a window without permission is something which lays outside of what the webplayer should be able to do.

However, if the user allows a webpage to close a window via javascript you can do it that way. Take a look at [Application.ExternalEval](http://unity3d.com/support/documentation/ScriptReference/Application.ExternalEval.html) and for more information on window.close see [this page](http://blogs.x2line.com/al/articles/350.aspx)
