connectseekers.com

Thursday, 27 October 2016

JavaScript : Check Browsers Popup is Blocked Or Not

10/27/2016 - By Pranav Singh 0

This article will show you how you can validate or check weather the browsers popup is blocked or not using JavaScript. If it's blocked you will get alert that popup is blocked using JavaScript.



So here is the code.

var newWin = window.open(url);
        if (!newWin || newWin.closed || typeof newWin.closed == 'undefined') {
            alert("Popup is blocked.")
        }


In above code i have tried to open a popup window if the browser popup is blocked then you will get alert message. Here is the complete code.

<script>
    function ValidatePopup(url) {
        var newWin = window.open(url);
        if (!newWin || newWin.closed || typeof newWin.closed == 'undefined') {
            alert("Popup is blocked.")
        }
    }
</script>

Button To open popup.<br />
<input type="button" value="Click For Popup" onclick="javascript: ValidatePopup('http://www.aspdotnet-pools.com');" />

About the Author

We are the group of people who are expertise in different Microsoft technology like Asp.Net,MVC,C#.Net,VB.Net,Windows Application,WPF,jQuery,Javascript,HTML. This blog is designed to share the knowledge.

Get Updates

Subscribe to our e-mail newsletter to receive updates.

Share This Post

0 comments:

Please let me know your view

Free Ebooks


About Us

We are the group of people who are expertise in different Microsoft technology like Asp.Net,MVC,C#.Net,VB.Net,Windows Application,WPF,jQuery,Javascript,HTML. This blog is designed to share the knowledge.

Contact Us

For writing article in this website please send request by your

GMAIL ID: dotnetpools@gmail.com
Email Id : contact@aspdotnet-pools.com

Bugs and Suggestions

As we all know that this website is for sharing knowledge and providing proper solution. So while reading the article is you find any bug or if you have any suggestion please mail us at contact@aspdotnet-pools.com.

Partners


Top jQuery Plugins

Global Classified : Connectseekers.com
© 2014
back to top