IE problem with open.window

A

Anna Quick

I am quite new to javascript, and don't seem to find the problem with
stupid internet explorer.
The script works fine in safari and mozilla.
I searched the groups, but evidently put in the wrong keywords, didn't
find the solution.
It seems to be as easy as it gets: open a new window with a new url.
in IE (I am using IE in mac osx), the error message is:

Microsoft JScript runtime error:
Line: 9
Char: 8
Error: Type mismatch

Thanks for any tips! I am getting crazy over this!
q.

here are the scripts:

test.js:
function launchDisplay(mydata) {
datasetWindow=window.open("describe_data.cgi" + mydata, " ",
"width=500,height=200,scrollbars=yes, resizable=yes")
}

test.html:
<head><title>Untitled Document</title>
<script language="JavaScript" src="test.js"
type="text/javascript"></script>
</head><body><a HREF="#" onClick="launchDisplay('?dataset=mydataset');
return false;">Display Properties of selected Dataset</a>
<br />
</body>
</html>
 
D

DU

Anna said:
I am quite new to javascript, and don't seem to find the problem with
stupid internet explorer.
The script works fine in safari and mozilla.
I searched the groups, but evidently put in the wrong keywords, didn't
find the solution.
It seems to be as easy as it gets: open a new window with a new url.
in IE (I am using IE in mac osx)

IE for Mac OS X is a rare bird.

, the error message is:
Microsoft JScript runtime error:
Line: 9
Char: 8
Error: Type mismatch

Thanks for any tips! I am getting crazy over this!
q.

here are the scripts:

test.js:
function launchDisplay(mydata) {
datasetWindow=window.open("describe_data.cgi" + mydata, " ",
"width=500,height=200,scrollbars=yes, resizable=yes")

Avoid an empty string for the window name. Avoid blank space in the 3rd
parameter of the window.open (in the windowFeatures string list): this
is an error for Netscape browsers.
}

test.html:
<head><title>Untitled Document</title>
<script language="JavaScript" src="test.js"

language is deprecated while type is both backward and forward-compatible.
type="text/javascript"></script>
</head><body><a HREF="#" onClick="launchDisplay('?dataset=mydataset');

The problem with this is that nothing happens (no document, no content
at all) if javascript support is disabled. About 8-12% of users have
javascript disabled. Your code here is not robust, not promoting
accessibility to content.
return false;">Display Properties of selected Dataset</a>


Try this:

In your html:
-------------
<a href="describe_data.cgi?dataset=mydataset" target="RequestedPopup"
onclick="launchDisplay(this.href, this.target); return false;"
title="Clicking this link will create a new window or will reuse an
already opened window">Display Properties of selected Dataset <img
src="http://www10.brinkster.com/doctorunclear/GRAPHICS/PNG/OpenRequestedPopup.png"
width="25" height="25" alt="[will create a new window]"></a>

In your <script> in your <head>:
--------------------------------

<script type="text/javascript">
var WindowObjectReference, strPreviousURL;
function launchDisplay(strCurrentURL, strTarget)
{
if(WindowObjectReference == null || WindowObjectReference.closed)
{
WindowObjectReference = window.open(strCurrentURL, strTarget,
"width=500,height=200,resizable,scrollbars,status");
}
else if(strPreviousURL != strCurrentURL)
{
WindowObjectReference = window.open(strCurrentURL, strTarget,
"width=500,height=200,resizable,scrollbars,status");
WindowObjectReference.focus();
}
else
{
WindowObjectReference.focus();
};
strPreviousURL = strCurrentURL;
}
</script>

You can furthermore develop the accessibility, usability ideas of such
script with cursor styling and make the new window coordinate positions
and dimensions entirely scalable, proportional to the user's browser
viewport.

DU
 
A

Anna Quick

DU,thanks for your help. Unfortunately, it still doesn't work.
I tried it on a windows xp computer, and IE gave an error message as
well.

The html file I posted is actually a very reduced one generated by
CGI.pm. I didn't do any browser checking/etc. yet, because I want to
have the basic function in place first.

The URL is:
http://www.operartists.net/test.html

The debugging error message in IE (XP) is: invalid argument (pointing
to the window.open line).


below again the current version of the files. I am sure that it is
something trivial that is wrong. Any help??? no problems with mozilla
or safari.
Thanks! q.

test.html:
<head><title>Dataset Test</title>
<script src="test.js" type="text/javascript"></script>
</head><body>
<a HREF="/cgi-bin/describe_datasets.cgi?dataset=testset"
target="Dataset Description"
onClick="launchDisplay('?dataset=testset'); return false;">Display
Properties of selected Dataset</a>
<br />
</body>
</html>

test.js:
var WindowObjectReference, strPreviousURL;
function launchDisplay(dataset_collection)
{
if(WindowObjectReference == null ||
WindowObjectReference.closed) {
WindowObjectReference =
window.open("/cgi-bin/describe_datasets.cgi" + dataset_collection,
"Dataset Description",
"width=500,height=200,resizable,scrollbars,status");
}
else if(strPreviousURL != dataset_collection) {
WindowObjectReference =
window.open("/cgi-bin/describe_datasets.cgi" + dataset_collection,
"Dataset Description",
"width=500,height=200,resizable,scrollbars,status");
WindowObjectReference.focus();
}
else {
WindowObjectReference.focus();
};
strPreviousURL = dataset_collection;
}
 
D

DU

Anna said:
DU,thanks for your help. Unfortunately, it still doesn't work.
I tried it on a windows xp computer, and IE gave an error message as
well.

The html file I posted is actually a very reduced one generated by
CGI.pm. I didn't do any browser checking/etc. yet, because I want to
have the basic function in place first.

The URL is:
http://www.operartists.net/test.html

The debugging error message in IE (XP) is: invalid argument (pointing
to the window.open line).


below again the current version of the files. I am sure that it is
something trivial that is wrong. Any help??? no problems with mozilla
or safari.
Thanks! q.

test.html:
<head><title>Dataset Test</title>
<script src="test.js" type="text/javascript"></script>
</head><body>
<a HREF="/cgi-bin/describe_datasets.cgi?dataset=testset"
target="Dataset Description"

target attribute value MUST NOT have a blank space; otherwise it won't
work in MSIE 6 for windows. That, I'm absolutely sure of. Use
target="Dataset_Description" or
target="DatasetDescription"
onClick="launchDisplay('?dataset=testset');

I recommend not making any concatenation operation when determining the
URI. This is not recommendable.

I'll examine your test.html page.

DU

return false;">Display
 
D

DU

Anna said:
DU,thanks for your help. Unfortunately, it still doesn't work.
I tried it on a windows xp computer, and IE gave an error message as
well.

The html file I posted is actually a very reduced one generated by
CGI.pm. I didn't do any browser checking/etc. yet, because I want to
have the basic function in place first.

The URL is:
http://www.operartists.net/test.html

The debugging error message in IE (XP) is: invalid argument (pointing
to the window.open line).


below again the current version of the files. I am sure that it is
something trivial that is wrong. Any help??? no problems with mozilla
or safari.
Thanks! q.

test.html:
<head><title>Dataset Test</title>
<script src="test.js" type="text/javascript"></script>
</head><body>
<a HREF="/cgi-bin/describe_datasets.cgi?dataset=testset"
target="Dataset Description"
onClick="launchDisplay('?dataset=testset'); return false;">Display

One 1 hand, you define the relative url of the referenced resource (the
href value), on the other hand, you call a function which will
concatenate string to establish the url value. This is not recommendable
and should be avoided. In the code I gave you, I edited the relative url
as the href value and then use this.href for the called function
launchDisplay. Not only this is better but it also help code
maintenance: you only have 1 string to update.
And I still maintain the rest I said in the other post: no blank space
in the target attribute value, do not concatenate strings when making
the window.open() call.
The complete code I provided should work in case the user has javascript
disabled.
For the sake of this, try your MSIE for Mac at this page:

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

You may try other pages in my javascript section which uses requested
popups. Let me know which pages which do not work.

DU
 

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

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,139
Latest member
JamaalCald
Top