Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open window without toolbars

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'");
}
like image 818
Joly Avatar asked Oct 03 '12 15:10

Joly


2 Answers

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).

like image 136
JYelton Avatar answered Oct 08 '22 23:10

JYelton


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.

like image 36
Joly Avatar answered Oct 08 '22 22:10

Joly