Welcome to WebmasterWorld Guest from 50.19.53.104

Forum Moderators: open

Message Too Old, No Replies

Is document.styleSheets broken in Safari?

     

scubby

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

5+ Year Member



<!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">
<head>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<script type="text/javascript">
alert(document.styleSheets.length);
</script>
</body>

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

MarkFilipak

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

5+ Year Member



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]

 

Featured Threads

Hot Threads This Week

Hot Threads This Month