igor-alexandrov / wiselinks

If Turbolinks are not enough for you. Wiselinks makes your application work faster.
MIT License
724 stars 89 forks source link

IE support is broken #20

Closed incubus closed 11 years ago

incubus commented 11 years ago

Hi!

When using Internet Explorer 8-9 I get the error:

SCRIPT5007: Unable to get value of the property 'html4': object is null or undefined:

Wiselinks.prototype.enabled = function() { return !History.emulated.pushState || this.options.html4 === true; };

What about this fix?

@@ -8,12 +8,12 @@ class Wiselinks
   constructor: ($target = $('body'), options = {}) ->
     this._try_jquery()

-    if this.enabled()
+    if this.enabled(options)
       options = $.extend(this._defaults(), options)
       @page = new _Wiselinks.Page($target, options)

-  enabled: ->
-    !History.emulated.pushState || @options.html4 == true
+  enabled: (options = {}) ->
+    !History.emulated.pushState || options.html4 == true

   load: (url, target, render = 'template') ->
     @page.load(url, target, render)
incubus commented 11 years ago

BTW, if I use "html4: true" option the browser endlessly reloads / page.

igor-alexandrov commented 11 years ago

Thanks for reporting. These is all effect of refactoring in 0.6.0 version. Fixed in wiselinks-0.6.2.

incubus commented 11 years ago

Thanks! Unfortunately it hasn't helped with endless requests to '/'.

igor-alexandrov commented 11 years ago

Please provide more information about this. What page are you visiting before redirect? Basically wiselinks everytime wants to reprocess your url from host/url to host/!#/url in html4 browsers. I know that it is not always right, but I cannot find better way to handle this.

incubus commented 11 years ago

Hi!

I see. I have a scope '(:locale)' in all routes and "before" filter that always redirects to host/locale/url when locale is blank. Is better disable html4 browser support in my project for now. :)

rbinsztock commented 11 years ago

i got the same problem with my routes, it does a redirect, so when i try to refresh a page i go back to home and go to the new page again, only on HTML4 browser.

igor-alexandrov commented 11 years ago

You can put html4_normalize_path: false during Wiselinks initialisation to disable this behaviour.

waiting-for-dev commented 10 years ago

I'm not sure if it is related with this issue, but I prefer commenting here before opening a new one...

In IE8, say for a page with url /about, there is following error:

Syntax error, unrecognized expression: #./about in jquery.js line 1851 character 2