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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mac IE5 won't apply CSS written by Javascript

Status
Not open for further replies.

TheDust

Programmer
Aug 12, 2002
217
US
CSS works fine on my page when I use it inline as well as when I link to external sheets. However, I'm finding that IE5 on Mac (our favorite browser) won't apply the stylesheet when written with the following Javascript:
Code:
if (navigator.appVersion.indexOf("MSIE 5.5") || navigator.appVersion.indexOf("MSIE 6")) {
  document.write('<'+'link rel="stylesheet" type="text/css" href="styles/iframe_win.css" />');
} else {
  document.write('<'+'link rel="stylesheet" type="text/css" href="styles/iframe_mac.css" />');
}
This is sniffer code to recognize IE 5.5 or above. I've done a LOT of testing and no matter what I do, I can't get any CSS file written by Javascript to get applied to the page being viewed. Is there some trick I'm not getting here? If it's any help, the page I'm working on is here:
 
I'd try reading through all the Mac IE CSS "odities" sites available... Here are the ones I can find:







Failing those being of any help, I would guess that IE/Mac just doesn't like stylesheets being written to the page dynamically.

Hope this helps,
Dan
 
Unfortunately Mac IE 5.5 is known to be full of bugs... especially with javascript.

Wow JT that almost looked like you knew what you were doing!
 
I'd say that if you put the full http reference on the stylesheet, then it would probably work Ok. What you are doing is putting the stylesheet reference in a place where it is decoded by the client browser, so it looks on the client machine... whereas if teh reference was:
then it may work..... but then again, maybe it won't

Hope this helps

Peter
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top