window.open not working in IE5

V

venkatesh

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=300,left=0,top=0')
}

Inside the HTML Body:

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

with regards
venkat.
 
D

DU

venkatesh said:
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=300,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/interact/scripts.html#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/doctorunclear/Netscape7/Popup/PopupAndNetscape7.html#OpenLinkNewWindow

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

http://www10.brinkster.com/doctorunclear/BrowserBugsSection/Opera7Bugs/Opera7Bugs.html

http://www10.brinkster.com/doctorunclear/HTMLJavascriptCSS/EnlargeThumbnail.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/doctorunclear/Netscape7/Netscape7Section.html
 
S

Stuart Palmer

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,738
Latest member
JinaMacvit

Latest Threads

Top