Thursday, July 17, 2014

Javascript in cross browser


I just started investigating on how to code javascript for cross plateform support. This is not complete I will update this blog in later. Please let me know if you are facing any cross plate-form issue so that i could help you.

      AVOID USING IF Browser = 'Internet Explorer' or 'morzilla' or 'chrome' CHECKINGS AS POSSIBLE. 

  •  use attribute function to set/get object/control property
               IE will support you to write script like,

                     MyIMG.src = 'https://www.google.com';

                but above line will not work in chrome and morzilla browsers. so re-write the code like which will work in IE, Morzilla, Chrome , safary etc etc.

                    MyIMG.setAttribute('src',''https://www.google.com');

                     to get property use getAttribute
                     ex: var imgsrc = MyIMG.getAttribute('src');

No comments: