javascript code works well in internet explorer but not in chrome or firefox RRS feed

  • Question

  • I have created a simple asp.net application with VS11 where there are few lines of javascript that create few tags. While all works well in internet explorer the code does not work at all with firefox and chrome?

    what is the best way to procede to prevent this kind of problems?

    Monday, April 30, 2012 5:59 AM


  • Develop using Firefox ? Anyway this is a subjective reply and hopefully others will chip in with their experience/s.

    Every browser has some sort of debugger or console available - eg

    IE - F12 (or Tools -> Developer Tools)

    Firefox - download and install Firebug extension + the Web Developer extension can also be quite handy.

    Chrome - CTRL + SHIFT + J  (or Wrench -> Tools -> Javascript Console)

    Personally I quite like JSLint - takes a bit of getting used to but I think it helps in the end to write stuff that doesn't need the debugging. Just need to choose suitable options and slowly reduce the errors it finds to zero. After a while you will probably get in the habit of writing stuff that has a lot less errors to begin with. I notice he is starting to exhibit a sense of humour - there is now an option - "Tolerate stupidity !"

    If you are writing for the web maybe don't use MSDN as your primary source of information. Find, bookmark and use a few sites that have good cross browser info and come to MSDN to find out why it's not working in IE.

    When you use a property, method, event or object etc, look it up. This will slow you down at first but will make you faster in the end.

    And search, search, search. Try prefacing your search question with the word "javascript."

    Any chance of seeing the script ?

    • Edited by mystifeid Monday, April 30, 2012 9:18 AM
    • Marked as answer by marck68 Monday, April 30, 2012 9:23 AM
    Monday, April 30, 2012 9:01 AM