Skip navigation
NessaFrankling
Currently Being Moderated

javascript problem with internet explorer

Aug 28, 2012 9:54 AM

Tags: #error #adobe #cs5.5 #dreamweaver #javascript #html5 #javascript_error #javascript_writing

Hi everyone

 

I have just created the following webpage http://www.dor2dor.com/client-testimonials.html whcih filters results based on your selection. Unfortunately this works perfectly on every browser except from blody internet explorer. I can for the life of me work out why this is any pointers would be much appreciated.

 
Replies
  • Currently Being Moderated
    Aug 28, 2012 11:07 AM   in reply to NessaFrankling

    NessaFrankling wrote:

     

    Unfortunately this works perfectly on every browser except from blody internet explorer. I can for the life of me work out why this is any pointers would be much appreciated.

    IE 9 has a very useful set of Developer Tools, which you access by pressing F12. If you open the Console, it tells you that the problem is on line 30 of testimonails.js. The history object in IE doesn't support the pushState() method.

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 29, 2012 2:58 AM   in reply to NessaFrankling

    No, sorry. That JavaScript file is more than 2000 lines long. I suggest that you contact the author of the file, and report the fact that it doesn't work in IE 9. The script is doing a lot of browser sniffing to find out which make and version of browser is being used. The error lies in that part of the code rather than just in line 30.

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 29, 2012 3:10 AM   in reply to NessaFrankling

    I've just checked testimonials.js at the URL you originally gave. It's 2007 lines long. I also ran it through the Developer Tools in IE 9, and it confirms that the error is on line 30 of that 2007-line script.

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 29, 2012 10:43 AM   in reply to NessaFrankling

    The history.pushState() method is a new HTML5 feature, which IE apparently doesn't support until IE 10.

     

    You can either use history.js to provide a cross-browser solution, or you can try using a nonstandard IE feature. According to an article in the Mozilla Developer Network, IE supports a string URL as a parameter for history.go().

     

    I haven't tried it out, but you might be able to adapt line 25 like this:

     

    if (window.history.pushState) {

        window.history.pushState('data', "Title", "/client-testimonials.html");

    } else {

        window.history.go("/client-testimonials.html");

    }

     

    Also change line 30 like this:

     

    if (window.history.pushState) {

        window.history.pushState('data', "Title", "/client-testimonials.html#" + scope);

    } else {

        window.history.go("/client-testimonials.html#" + scope);

    }

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 30, 2012 9:15 AM   in reply to NessaFrankling

    I'm glad that worked. I wasn't aware that IE supported that nonstandard use of history.go() until I stumbled across it on the Mozilla site.

     

    In one sense, life will be a lot simpler when all browsers support the new JavaScript APIs because the same script should work anywhere. But it will become a lot more complicated because there will be so many features we'll have to remember how to use.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points