Open jacobcoens opened 12 years ago
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.
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?
Hi Oliver, I'll have to check previous versions of my code, will check back asap!
Date: Tue, 10 Jan 2012 06:48:52 -0800 From: reply@reply.github.com To: jacobcoens@hotmail.com Subject: Re: [davis.js] hashRouting does not work in IE8 when using html5 doctype (#24)
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?
Reply to this email directly or view it on GitHub: https://github.com/olivernn/davis.js/issues/24#issuecomment-3430681
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 ;-)