leaflet.photon icon indicating copy to clipboard operation
leaflet.photon copied to clipboard

IE8?

Open amnesia7 opened this issue 11 years ago • 4 comments

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

amnesia7 avatar Oct 12 '14 18:10 amnesia7

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.

amnesia7 avatar Oct 13 '14 18:10 amnesia7

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!

christophlingg avatar Oct 14 '14 08:10 christophlingg

@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 avatar Oct 20 '14 22:10 amnesia7

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.

amnesia7 avatar Oct 27 '14 21:10 amnesia7