I am using an iframe in a page where the iframe looks like a div on the main asp.net page. In the Iframe page i have got a close button and when i click on close button i am calling a javascript function in iframe page which is having the code as:
window.location.href = “Pagename.aspx”;
this line closes the Iframe but the main page which contains Iframe refreshes after closing the iframe so…. I tried in many ways to close the iframe without refres like
window.close();
but it is not working. The main problem to close the iframe is that the close btn is in the iframe page it self so if i write the code to close iframe in iframe page that does not work…..
The main issue being that the iframe close btn should work like a div close btn that means when i click the close btn div can be made as dislay none but iframe how can i make it close when the iframe value can be accessed in the main page that contains iframe but that iframe page cannot get the iframe name….
So, can u please help me solve this issue .. that is closing of iframe without refreshing main page that contains iframe. Thanking you in advance!!
Do you control the parent page? You could put the script to close the iframe in the parent. So, in the parent page you have
and then call parent.myCloseIframeFunction() from the iframed page.