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.
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');" />
|
0 comments:
Please let me know your view