By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,287 Members | 1,524 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,287 IT Pros & Developers. It's quick & easy.

Script help for mulitple browsers

P: 2
Hi everyone
I know this has probably been asked a million times before but I have been searching the net for hours and have not found a solution so I am hoping one of you clever people will be able to help me. PLEASE!!

I am using this snow fall script

It works perfectly in IE but not in Firefox or Safari.

Anyone have any idea how to help? I am not the best with the techno speak so not too complicated if at all possible!

Thank you so much to anyone who can help me out!
Dec 9 '09 #1
Share this Question
Share on Google+
3 Replies

Expert Mod 5K+
P: 8,639
this script is not cross browser compatible (as far as I can tell from the first glance) you’d need to replace the used IE proprietary properties by something, that is able to read either ways.
Dec 9 '09 #2

P: 2
Thanks for your reply, sorry to be so thick but do you know how I do this? I have no idea!!
Dec 9 '09 #3

Expert Mod 5K+
P: 8,639
basicly you have to do a conditional block, where you loop through all (mostly 2) known properties to get the value you want.

ex. (the properties may not be correct, just pulling from memory)
Expand|Select|Wrap|Line Numbers
  1. // always start with the ECMAScript or W3C standard
  2. if (window.clientWidth)
  3. {
  4.     var width = window.clientWidth;
  5. }
  6. // then test IE proprietary features
  7. else if (window.screenX)
  8. {
  9.     var width = window.screenX;
  10. }
  11. // throw error in case you’ve forgotten something
  12. else
  13. {
  14.     throw new Error("Could not determine browser width.");
  15. }
it may well be that there are such crossbrowser functions are already out there (e.g. there is a bunch of solutions for event handling)
Dec 9 '09 #4

Post your reply

Sign in to post your reply or Sign up for a free account.