code_junkie

How can one detect via Javascript if a print stylesheet is in effect?

Nov 12th, 2011
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. function getActiveStyleSheet()
  2. {
  3. var i, a;
  4.  
  5. for (i = 0; (a = document.getElementsByTagName("link")[i]); i++)
  6. {
  7. if (a.getAttribute("rel").indexOf("style") != -1
  8. && a.getAttribute("title")
  9. && !a.disabled)
  10. return a.getAttribute("title");
  11. }
  12.  
  13. return null;
  14. }
Add Comment
Please, Sign In to add comment