Click to See Complete Forum and Search --> : newWin glitch
tburg
05-26-2003, 09:32 AM
We link to a lot of government information from our site, and we use the newWin function to open a new window for these links. Because our site acts as a sort of springboard to lots of other information, it's appropriate that our page remain open.
However, some users have serious problems with the script we're using. We've even had some AOL users say it shuts their browser down altogether.I'm hoping someone out there can help.
Here's the code we use in our page headers:
<script type="text/javascript">
<!--//
function newWin(obj){
winOpt = "scrollbars=yes,resizable=yes,width=600,height=730";
newWin = window.open(obj.href,obj.target,winOpt);
}
//-->
</script>
And here's the format we use for linking:
<a href='http://www.publicrecordsinfo.com/court_records/newyork_court_records.htm' onclick='newWin(this); return false;'>Courts in New York</a>
We have thousands of links on our site, so I'm trying to avoid a change that requires us to move the URL to a new position in the linking structure. We've been unable to reproduce this problem on our own machines. Can anyone provide any insight?
Well, the AOL browser sucks eggs to be honest, but in any case, I would add a target attribute (since that's what you're calling with obj.target, which returns undefined, instead of null. Null would work, but undefined names the window, "undefined") to the anchor element.
Uh, I mean that the anchor (A tag) should have target="someName" for example. It was just a suggestion, because obj refers the the anchor. Unless the anchor has a default value for its target property (which may be possible, as it may be _self), the function's obj.target will return 'undefined.' Meaning that the window's name will be, "undefined," am I right?
khalidali63
05-26-2003, 03:25 PM
Originally posted by tburg
r page headers:
function newWin(obj){
winOpt = "scrollbars=yes,resizable=yes,width=600,height=730";
newWin = window.open(obj.href,obj.target,winOpt);
}
The most likely(my opinion without running it) problem is/could be the function newWin(obj)
and then having the new window named
newWin = window.open.....
at this point javascript engine might think that open a window and set the reference to the newWin which in turn is a method,in my opinion,this is a "must not" to do thing
EDIT:
Having tested the code above,it sure is the same name for the window and the popup win that could be causing probs,( I don't have aol so I could not test it)
here is the code you should use,and unless there is a reasone for global variables,you should refrain from using global variables.
function newWin(obj){
var winOpt = "scrollbars=yes,resizable=yes,width=600,height=730";
var popup = window.open(obj.href,obj.target,winOpt);
}
I second Dave when he said that AOL uses IE,
Hey Jona if AOL browser sucks,then what you say about IE ..(joking)
:D
tburg
05-26-2003, 04:25 PM
I'm sorry; we did use the var construction, as in the following headers:
<script type="text/javascript">
<!--//
function newWin(obj){
var winOpt = "scrollbars=yes,resizable=yes,width=640,height=730";
var thisWin = window.open(obj.href,obj.target,winOpt);
}//-->
</script>
Are you suggesting, then, that we change the function name from newWin to popup ( to avoid the problems that Dave mentions with the "new" construction)?
If we do that, then our links should have the following format, correct?
<a href='http://www.publicrecordsinfo.com/court_records/newyork_court_records.htm' onclick=' popup(this); return false;'>Courts in New York</a>
khalidali63
05-26-2003, 04:30 PM
Originally posted by tburg
If we do that, then our links should have the following format, correct?
<a href='http://www.publicrecordsinfo.com/court_records/newyork_court_records.htm' onclick=' popup(this); return false;'>Courts in New York</a>
Yep exactly...
tburg
05-26-2003, 04:31 PM
A second thought occurs to me. Dave notes that 90% of our users will be able to use javascript without a problem. We have pretty good traffic - 10% having a problem would mean that 30,000 users a month potentially encounter problems. Obviously, that's not an acceptable number.
Is there a way to tie browser detection and/or javascript capability into this sort of script?
Originally posted by khalidali63
Hey Jona if AOL browser sucks,then what you say about IE ..(joking)
:D
It's not the way the AOL browser formats things that gets me--it's just that it doesn't work good at anything. I just don't like the way it looks and stuff. I mean, you have this big ol' ugly bar taking up half of your screen, just to be online! And not only that, there are a lot of sites that don't even work because of the way the AOL browser is. As a matter of fact, the way it's set up, a lot of forums say that you're IP banned when it's just the fact that you're using AOL and it thinks you're banned because of the way it operates. Whew!
And for the record, I do not use AOL. ;)
khalidali63
05-26-2003, 04:46 PM
Man ....you must be feeling lighter now jona..:D
EDIT:
Oh BTW,
you can use <noscript>tags with some information in them to direct or point user to another resource int that case..
tburg
05-26-2003, 04:51 PM
It's amazing that this same aol discourse has been going on since 96 - (or was it 95?) - when AOL entered the fray. Someday soon we'll probably call it Time Warner bashing.
The thing is, tho, for all our hubris about AOL, it still accounts for a huge proportion of traffic on general interest sites. AOL users may not be Web developers, but they're certainly Web users. We mock AOL at our own peril.
khalidali63
05-26-2003, 04:56 PM
Originally posted by tburg
We mock AOL at our own peril.
To be honest with you,I don't mock or hate AOL,on the contrary I have this firm believe that if it were not AOL,we still would have internet access by compuserv and the likes may be 10 dollars a minute,and I am sure you'd remember they charged arms and legs for internet access,it was AOL that dropped the price 19.95 for 24 hr access late in 95..and begun the inernet revolution....
My problem is only with AOL with respect to the browser,I just wish they used Mozilla based browser..(heheheh)
I don't know if I should rephrase, or repeat, what I've just said or not... :p
tburg
05-26-2003, 05:05 PM
You're both absolutely right about the browser. It's like the old analogy to the early days of railroading, when every greedy RR line wanted its gauge track to become the standard.
What drives me crazy is that it's the passenger - even more than the engineer - who suffers. We have a site that helps people find information about communities (www.epodunk.com). That means we're often helping people who are traveling, or who are researching a move to a new place.
I'm amazed that we actually have users who - after having their browsers crash - still take the time to email us, and then will click on our test pages to help us fix the problem.