homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

Is document.styleSheets broken in Safari?

 7:22 pm on Mar 20, 2008 (gmt 0)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<link rel="stylesheet" type="text/css" href="style.css" />
<script type="text/javascript">

Is this supposed to work in Safari?
It's returning 0... There's a style sheet there! No, style.css isn't 404ing...

Tried on Safari/Win, Safari/Mac, and Safari/iPod Touch



 10:06 pm on Mar 20, 2008 (gmt 0)

javascript:alert(document.styleSheets.length); in the location bar of Safari/Win 3.0.2 works for me (returns '2' for a particular page that was handy).

Try running your javascript via <body onload='yourScriptHere()'>.

[edited by: MarkFilipak at 10:09 pm (utc) on Mar. 20, 2008]

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved