Avatar of VBdotnet2005
VBdotnet2005Flag for United States of America

asked on 

Close browser when using Iframe

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.
ASP.NETHTMLJavaScript

Avatar of undefined
Last Comment
Alexandre Simões
Avatar of Pravin Asar
Pravin Asar
Flag of United States of America image

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


e.g.

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

function closeWin() {
    myWindow.close();   // Closes the new window
}
ASKER CERTIFIED SOLUTION
Avatar of Alexandre Simões
Alexandre Simões
Flag of Switzerland image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
ASP.NET
ASP.NET

The successor to Active Server Pages, ASP.NET websites utilize the .NET framework to produce dynamic, data and content-driven web applications and services. ASP.NET code can be written using any .NET supported language. As of 2009, ASP.NET can also apply the Model-View-Controller (MVC) pattern to web applications

128K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo