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="" 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'");
}
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." 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'");
}
Share
Improve this question
edited Apr 7, 2020 at 8:52
Faisal Rahman Avash
1,2569 silver badges13 bronze badges
asked Oct 3, 2012 at 15:41
JolyJoly
3,27614 gold badges48 silver badges74 bronze badges
3
- Does it matter that you spelled the "status" option at the end wrong? – Ian Commented Oct 3, 2012 at 15:44
- 1 Also, what do you expect the "toolbars" to mean? Take a look at developer.mozilla/en-US/docs/DOM/window.open to get all options. – Ian Commented Oct 3, 2012 at 15:45
- 1 The third param is just a ma-separated list of key=val pairs, not an assignment string. Remove the config='' portion of it. – SeanCannon Commented Oct 3, 2012 at 15:49
3 Answers
Reset to default 8A 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).
There were several issues in your code:
- There should be only 3 ws in
wwww.google.
- Unnecessary
config='
. Also remove that final closing'
. atus=no
should bestatus=no
Correcting these issues makes the pop-up work:
<a href="http://www.google." 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>
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.