Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

hashRouting does not work in IE8 when using html5 doctype #24

Open
jacobcoens opened this Issue · 3 comments

2 participants

@jacobcoens

In Internet Explorer 8, when using the html5 doctype and not specifying a document compatibility mode (by using the "X-UA-Compatible" header or meta-tag), hashRouting does not work. This is because in this situation, IE renders the page in Quirks mode and therefore does not support the hashChange event, even though the browser reports that it does. Explanation: http://stackoverflow.com/a/4029796

In the extension, the check whether the onhashchange is supported (davis.hashRouting.js, line 87), should be extended with the a check whether the Document Compatibility mode if IE is at least 8 (Document compatibility modes: http://msdn.microsoft.com/en-us/library/cc196988.aspx) so that it falls back to polling if it isn't.

Sample code to determine the Document Compatibility mode can be found here: http://msdn.microsoft.com/en-us/library/cc288325.aspx#GetMode

Of course, you could also tell people to specify the document compatibility mode when using the html5 doctype ;-)

@olivernn
Owner

I think that using the html5 doctype and not specifying a document compatibility mode is something that people are likely to do, so this is something that should be fixed. The change doesn't look to big, I'll put together a fix and put it into the next release.

@olivernn
Owner

Sorry for the delay on this. I am trying to re-create the issue but don't seem able to. I have the following code:

<!DOCTYPE html>

<script src="/examples/jquery.js" type="text/javascript" charset="utf-8"></script>

<script src="/lib/davis.js"></script>
<script src="/lib/davis.history.js"></script>
<script src="/lib/davis.location.js"></script>
<script src="/lib/extensions/davis.hashRouting.js"></script>
<script src="/lib/davis.utils.js"></script>
<script src="/lib/davis.listener.js"></script>
<script src="/lib/davis.event.js"></script>
<script src="/lib/davis.logger.js"></script>
<script src="/lib/davis.route.js"></script>
<script src="/lib/davis.router.js"></script>
<script src="/lib/davis.request.js"></script>
<script src="/lib/davis.app.js"></script>

<script>
  Davis.extend(Davis.hashRouting({forceHashRouting: true}))

  app = Davis(function () {
    this.get('/foo', function () {
      alert('foo!')
    })
  })
</script>

<a href='/foo'>Foo!</a>

But the hash routing seems to be working correctly. I even tried forcing IE8 into compatibility mode using <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" /> but the hashRouting was still working for me?

Do you have an html snippet that I can use to re-create the issue?

@jacobcoens
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.