Close browser when using Iframe

VBdotnet2005 used Ask the Experts™
I have an aspx page where it contains two iframes, top for navigation and bottom for contains. I want to put  link on top ifram where when click, I want to close the entire browswer.
So far I have found no solution.
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Pravin AsarPrincipal Systems Engineer
Top Expert 2005

For security reasons, you can not browser window/tab through Javascript windows.close() function, unless it is opened/created by your web applications/site.

window.close() or self.close() will work, only if window is open by javascript


function openWin() {
    myWindow ="", "myWindow", "width=200, height=100");   // Opens a new window

function closeWin() {
    myWindow.close();   // Closes the new window
Manager / Solutions Architect
Well, you can try this hack:
function CloseWindow() {
  var cWindow =, '_self');

Open in new window

Basically, it simulates the opening of the window in itself and closes it right after.
It should work everywhere.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial