Click here to Skip to main content
14,325,352 members
Rate this:
Please Sign up or sign in to vote.
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
Rate this:
Please Sign up or sign in to vote.

Solution 2

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:
popup_window = window.open("");
....
popup_window.close();
   
Rate this:
Please Sign up or sign in to vote.

Solution 1

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, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100