Skip to content

Instantly share code, notes, and snippets.

@ghusta
Last active December 18, 2015 07:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ghusta/5747542 to your computer and use it in GitHub Desktop.
Save ghusta/5747542 to your computer and use it in GitHub Desktop.
Open new popup window without address bars nor toolbars in firefox & IE (uses Javascript). See also http://www.w3schools.com/jsref/met_win_open.asp
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Index</title>
<script type="text/javascript">
var _MsgWindowOpenError = 'Un mécanisme de blocage des fenêtres instantanées a été détecté dans votre navigateur Web. Ce type de mécanisme empêche le bon fonctionnement de cette application. Désactivez le mécanisme de blocage des fenêtres instantanées ou autorisez les fenêtres liées à ce site.';
var _MsgWindowOpenError2 = 'Attention le filtre anti-popups est activé ou le niveau de sécurité de Internet Explorer n\'est pas correctement configuré.';
function openPopup()
{
if (window.name != "nouvelle")
{
var options = "toolbar=no,location=no,status=yes,resizable=yes,scrollbars=yes";
var url = "target-popup.html";
var newWin = window.open(url, "nouvelle", options);
if (newWin == null)
{
// window.status = "Nouvelle fenetre null : popup bloquée !";
window.alert(_MsgWindowOpenError);
}
else if (window.top != newWin)
{
window.opener = window.self;
window.self.close();
}
}
}
</script>
</head>
<body onload="openPopup()">
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>New window from popup</title>
</head>
<body>
This page must be opened in a new window without toolbars...
</body>
</html>
@ghusta
Copy link
Author

ghusta commented Jun 10, 2013

Uses Javascript.

See also Window open() Method

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment