komoot / leaflet.photon

Apache License 2.0
50 stars 13 forks source link

IE8? #2

Open amnesia7 opened 10 years ago

amnesia7 commented 10 years ago

Does this line https://github.com/komoot/leaflet.photon/blob/master/leaflet.photon.js#L54 mean that this plugin doesn't support IE8?

amnesia7 commented 10 years ago

I've checked the demo here (http://photon.komoot.de/) and it fails in IE8 because of the use of indexOf (https://github.com/komoot/leaflet.photon/blob/master/leaflet.photon.js#L150) and it fails in IE9 as well complaining of an Invalid character here (https://github.com/komoot/leaflet.photon/blob/master/leaflet.photon.js#L362). Making indexOf work could be done using this (http://stackoverflow.com/a/3629211/1116573) to add the function if it doesn't exist or another option could be to use jquery's $.inArray() if jquery has been loaded.

christophlingg commented 10 years ago

i am not so aware of that as @yohanboniface wrote the plugin. are you familiar with javascript and can make a pull request with ie support? that would be great!

amnesia7 commented 9 years ago

@yohanboniface Something like this to replace L150 might help...

        var specialKey = false;
        for (var i = 0; i < special.length; i++)
        {
            if (special[i] === e.keyCode)
            {
                specialKey = true;
            }
        }
        if (!specialKey)

...although it only got me to the next bit of js that doesn't work in older IE which was here (https://github.com/komoot/leaflet.photon/blob/master/leaflet.photon.js#L353) in IE8 and I'm a bit stuck with the next issue about the ajax request.

amnesia7 commented 9 years ago

I'm not sure if it relates to the issue here with IE8 and 9 or not but when trying to use photon with typeahead.js plugin it required this javascript (https://github.com/MoonScript/jQuery-ajaxTransport-XDomainRequest) to be called because it needs to do a cross domain request for the json and IE8 and 9 only allow jsonp across domains. This script gets around that but isn't ideal to require an extra resource. @christophlingg it might be worth the ability to pass a &callback=? in the api request so that it returns valid jsonp (the json is wrapped in a javascript function) should it be needed.