Pop-up Blockers
You can tell if a pop-up was blocked by checking the return value: When a browser add-on or other program blocks a pop-up, window.open() typically throws an error.
<!DOCTYPE HTML>
<html>
<head>
<title>Example</title>
</head>
<body>
<script type="text/javascript">
var blocked = false;
try {
var myWin = window.open("http://www.google.com", "_blank");
if (myWin == null){
blocked = true;
}
} catch (ex){
blocked = true;
}
if (blocked){
document.writeln("The popup was blocked!");
}
</script>
</body>
</html>
Home
JavaScript Book
DOM
JavaScript Book
DOM
Window:
- The Window Object
- The Window Events
- window.alert() or alert()
- window.close()
- window.confirm() or confirm()
- window.find() displays find dialog
- window's outer width and height, inner height and width
- window.location
- window.moveBy(distance, distance)
- window.moveTo(x,y) moves the window to the upper-left coordinate
- window.open()
- window.print()
- window.prompt() and prompt()
- window.resizeTo(x,y) and window.resizeBy(xDelta,yDelta)
- window.scrollTo(x,y)
- window.screenLeft, window.screenX, window.screenTop, window.screenY
- window.setInterval() or setInterval()
- window.setTimeout() or setTimeout()
- Pop-up Blockers