You need to sign in to do that
Don't have an account?
Lakshman
How to close a popup window when clicked outside popup
Hi All,
I have a VFP which has a button which on clicked opens a new popup having different VFP. To open the popup I have used window.open method of JS.
I want that when I click outside the popup it should get closed. Any thoughts/ideas to it are welcomed.
I want you to know that I have used this function:
<script> window.onblur=function(){ self.close(); }; </script>
Now whenever I click on popup window itself, it gets closed. LOL, this is weird.
Waiting for your replies.
Regards,
Lakshman.
You can use a trick
Set a var
Just try this,
If any issue you please let me know,
One more thing I think showModalDialog is also usefull for you as it disable parent window.
http://javascript.gakaa.com/window-showmodaldialog-4-0-5-.aspx
Hi Shashikant,
Thanks for your reply.
I am able to achieve my goals by my above script in all browsers except IE. In IE what happens you know, whenever I click on any element of the popup page, the pop up gets Closed while in other browsers it doesn't i.e... It behaves normal as I expected.
Regarding your next suggestion, I have first tried showModadialog but there were some issues in IE so I switched to window.open. But now I am facing this new weird issue.
This is my popup code:
Just try this code in IE you will find that whenever you click on drop down arrow of select list, the pop will get close. For other browsers it would just work absolutely FINE.
Let me know your thoughts for making this work in IE.
Thank you!
Regards,
Lakshman.
have you tried the window.top.close() instead of self.close().Tryout this one and let me know if there is any issues..
I tried window.top.close()....... works fine in all browsers except IE. I am facing same problems as earlier.
Regards,
Lakshman