Reputation: 3276
I am trying to open new window without toolbars using the code below but it opens new window with the toolbars (at least in IE). Any idea what am I doing wrong?
<a href="http://www.google.com" onclick="popupWindow(this.href)" target="_blank"><img src="/myImage"/><a>
function popupWindow(url)
{
window.open(url,"MyWindow","config='toolbar=no, menubar=no,scrollbars=no,resizable=no,location=no,directories=no,status=no'");
}
Upvotes: 6
Views: 34114
Reputation: 13853
There were several issues in your code:
wwww.google.com
config='
. Also remove that final closing '
. atus=no
should be status=no
Correcting these issues makes the pop-up work:
<a href="http://www.google.com" onclick="popupWindow(this.href)" target="_blank">Click</a>
<script type="text/javascript">
function popupWindow(url)
{
window.open(url,"MyWindow","toolbar=no, menubar=no,scrollbars=no,resizable=no,location=no,directories=no,status=no");
}
</script>
Upvotes: 4
Reputation: 3276
Thanks to everyone for replying.
The issues mentioned were typos here, they were correct on my original code.
For some reason in IE the name of the window has to be an empty string. So, if I rename "MyWindow" to "" it works. Strange but googling shows more people have this problem.
Upvotes: 2
Reputation: 36512
A quick Google search found the syntax for this at DevShed:
<script language="javascript">
function myPopup(url, windowname, w, h, x, y)
{
window.open(url, windowname, "resizable=no, toolbar=no, scrollbars=no, menubar=no, status=no, directories=no, width=" + w + ", height=" + h + ", left=" + x + ", top=" + y);
}
</script>
Note that it differs from your own in that you have config=
as part of the last argument, and it's not needed (as AlienWebguy pointed out).
Upvotes: 8