Click here to Skip to main content
15,078,455 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
when i click on menu item ,webpage opens in new browser tab but now i want close the browser tab when i click on button.
Posted

Assuming that you are trying to do it from the actual webpage itself, you would use self.close(); to do this in JavaScript on the page. If you are trying to close a window you opened up, you need to capture the window reference when you create it, and then you can close that window like this:
JavaScript
popup_window = window.open("");
....
popup_window.close();
   
You can use window.close() function of javascript to achieve this.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900