By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,046 Members | 2,105 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,046 IT Pros & Developers. It's quick & easy.

window.open not working in IE5

P: n/a
Hi Members,

I have used the below mentioned code to open a html page in a new
browser. The window size is 200 x 300. In that browser, I've given
code to open another browser of the same size. However, this is not
happening in IE 5. Can anyone help me solve this problem?

Code:

Script:
function newwindow1(newurl)
{
popupWin=window.open(newurl,'open_window','menubar =no,toolbar=no,location,directories,status,
scrollbars,resizable,dependent,width=200,height=30 0,left=0,top=0')
}

Inside the HTML Body:

<a href="#" onclick="javascript:newwindow('new.html');"
class=lin>CLICK HERE a></P>

with regards
venkat.
Jul 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
DU
venkatesh wrote:
Hi Members,

I have used the below mentioned code to open a html page in a new
browser. The window size is 200 x 300. In that browser, I've given
code to open another browser of the same size. However, this is not
happening in IE 5. Can anyone help me solve this problem?

Code:

Script:
function newwindow1(newurl)
{
popupWin=window.open(newurl,'open_window','menubar =no,toolbar=no,location,directories,status,
scrollbars,resizable,dependent,width=200,height=30 0,left=0,top=0')
1- dependent is only supported in NS 4+ and in Mozilla-based browsers
2- you can make the windowFeatures string list more compact like this:

popupWin=window.open(newurl, "open_window",
"location,directories,status,scrollbars,resizable, dependent,width=200,height=300,left=0,top=0");
Once a single window feature has been defined, all others which are not
defined are turn off.
}

Inside the HTML Body:

<a href="#" onclick="javascript:newwindow('new.html');"
class=lin>CLICK HERE a></P>


Not good.
1- If javascript is disabled or not supported, the requested popup
window will not be opened when it should. 8% to 12% of users surf with
javascript support disabled or with a browser without javascript.
2- The popup might open but then the default action of the link is not
cancelled: the opener is scrolled all the way back to the top after the
opening of the window.
3- The "javascript:" part in the onclick event handler is pointless,
unneeded. You may declare in the <head> section
<meta http-equiv="Content-Script-Type" content="text/javascript">
to declare the default scripting language in your document:
http://www.w3.org/TR/html401/interac...default-script
4- the class attribute value should be quoted
5- Absolutely avoid "Click here" link labels. Use a descriptive label:
http://www.w3.org/QA/Tips/
Don't use "click here" as link text:
http://www.w3.org/QA/Tips/noClickHere
6- newwindow is called but only newwindow1 is declared and defined. That
was probably why you thought window.open was not working.

So:
<p><a href="new.html" target="open_window"
onclick="newwindow1(this.href); return false;" title="Clicking this link
will open another window (popup)">See my garden <img
src="http://www10.brinkster.com/doctorunclear/BrowserBugsSection/Opera7Bugs/Opera7BugDisplayInline.html"
style="width:25px; height:25px; border:0px none;" alt="alt="Clicking the
link will create a new window (popup)"></a></p>

The code could be further improved to make the requested popup recycling
referenced, targeted resources. Only 1 popup opened at a time for
possibly several links.
Also, the code could be improved so that if the popup loses focus, it
can be brought back by clicking the opener's link. Right now, as coded,
the newwindow1 function does not do that... and this is known to be a
very frequent usability problem, confusion factor for users.

Open a link in a new window: when and how can that setting affect my
surfing?
http://www10.brinkster.com/doctorunc...nLinkNewWindow

Examples of use of recycling resources with/for a single popup:

http://www10.brinkster.com/doctorunc...pera7Bugs.html

http://www10.brinkster.com/doctorunc...Thumbnail.html

DU
--
Javascript and Browser bugs:
http://www10.brinkster.com/doctorunclear/
- Resources, help and tips for Netscape 7.x users and Composer
- Interactive demos on Popup windows, music (audio/midi) in Netscape 7.x
http://www10.brinkster.com/doctorunc...e7Section.html

Jul 20 '05 #2

P: n/a
Your function being called has a different name to the function (newwindow1
and newwindow), remove the 1 in the funciton name. I have ie 5.5 and it
works for me.

Hope that helps

Stu

"venkatesh" <ve*********@yahoo.co.in> wrote in message
news:b2**************************@posting.google.c om...
Hi Members,

I have used the below mentioned code to open a html page in a new
browser. The window size is 200 x 300. In that browser, I've given
code to open another browser of the same size. However, this is not
happening in IE 5. Can anyone help me solve this problem?

Code:

Script:
function newwindow1(newurl)
{
popupWin=window.open(newurl,'open_window','menubar =no,toolbar=no,location,di
rectories,status, scrollbars,resizable,dependent,width=200,height=30 0,left=0,top=0')
}

Inside the HTML Body:

<a href="#" onclick="javascript:newwindow('new.html');"
class=lin>CLICK HERE a></P>

with regards
venkat.

Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.