Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

object detection to see if IE 7

Status
Not open for further replies.

youngApprentice

Programmer
Jan 28, 2007
16
0
0
US
Due to return false; being ignored in IE 7 on Windows Vista, for something like the following:
<a href="myPage.html" onclick="popupWindow("myPage.html");return false;">link text here</a> what do I use for object detection to pinpoint IE7?

When IE7 hits a link created like this, it makes the popup open with the url supplied, but then the parent window goes to the href even though JavaScript is enabled and the popup has already opened.

TIA,
youngApprentice
 
Even though I can't test this right now, you could try this work around (although I haven't even tested the initial action that you are having a problem with):
Code:
<a href="myPage.html" onclick="popupWindow("myPage.html");[!]this.href='#'[/!];">link text here</a>
Let us know how you go.

Cheers,
Jeff

[tt]Jeff's Blog [!]@[/!] CodeRambler
[/tt]

Make sure your web page and css validates properly against the doctype you have chosen - before you attempt to debug a problem!

FAQ216-6094
 
Thanks Jeff,

Here's the situation, your suggestion works, but we'd have to modify around 1100 pages. I'm wondering if there's a couple of specific objects that can be detected for IE7, to set event.returnValue=false in the JavaScript file which includes our popup code, so we can modify the one file and not have to change the 1100 pages.

I still can't believe that the hyperlink onclick behavior is different for IE7 on Vista compared to Windows XP, 2000, and all the other browsers.

Thanks,
youngApprentice
 
There is a long thread here:

I wonder if you used a 10ms timeout...
Code:
...
function popupWindow(l_sURL) {
  void(setTimeout('popupWindow2(' + l_sURL + ')', 10));
}
...

Since that thread indicates the problem happens if the funtion has a location.href in it. By using setTimeout() this breaks the inheritance chain.

You would need to move your current popupWindow() to become popupWindow2() - but this would be just the one file that you are changing.

Cheers,
Jeff

[tt]Jeff's Blog [!]@[/!] CodeRambler
[/tt]

Make sure your web page and css validates properly against the doctype you have chosen - before you attempt to debug a problem!

FAQ216-6094
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top