Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Detecting if a popup has been blocked

Opening and closing a window

Detecting if a popup has been blocked

by  BillyRayPreachersSon  Posted    (Edited  )
This works for me in IE6 and FF1 to detect whether a popup was blocked or not:

Code:
<html>
<head>
	<script type="text/javascript">
	<!--
		function openWin() {
			var winHandle = window.open('http://www.google.co.uk/', '', '');
			if (winHandle == null) alert('Popup was blocked');
		}
	//-->
	</script>
</head>
<body onload="openWin();">
</body>
</html>

Dan


[link http://www.coedit.co.uk/][color #00486F]Coedit Limited[/color][/link][color #000000] - Delivering standards compliant, accessible web solutions[/color]

[tt]Dan's Page [blue]@[/blue] Code Couch
http://www.codecouch.com/dan/[/tt]
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top