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

Open
jacobcoens opened this Issue Dec 7, 2011 · 3 comments

Comments

Projects
None yet
2 participants
@jacobcoens
Contributor

jacobcoens commented Dec 7, 2011

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

This comment has been minimized.

Show comment Hide comment
@olivernn

olivernn Dec 12, 2011

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.

Owner

olivernn commented Dec 12, 2011

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

This comment has been minimized.

Show comment Hide comment
@olivernn

olivernn Jan 10, 2012

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?

Owner

olivernn commented Jan 10, 2012

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

This comment has been minimized.

Show comment Hide comment
@jacobcoens

jacobcoens Jan 23, 2012

Contributor

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:
#24 (comment)

Contributor

jacobcoens commented Jan 23, 2012

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:
#24 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment