javascript - Set ajax url with localStorage does not work in Firefox -



javascript - Set ajax url with localStorage does not work in Firefox -

i doing little gpx-parser google-maps javascript/jquery. have upload-form user can upload gpx-file. file (the url file) stored in localstorage because need path in file. (see below)

<h1>gpx-upload</h1> <input type="file" id="gpxinput" /> <button onclick="localstorage.clear()">clear</button><br /><br /> <div id="success"></div> <script type="text/javascript"> var inputelement = document.getelementbyid("gpxinput"); inputelement.addeventlistener("change", handlefiles, false); function handlefiles() { var filelist = this.files; //create url uploaded file var objecturl = window.url.createobjecturl(filelist[0]); //create local variable localstorage.setitem("gpxurl", objecturl); $( "div#success" ).html('<p>upload done</p>'); } </script>

i display gpx-track next code:

$.ajax({ type: "get", url: localstorage.getitem('gpxurl'), datatype: "xml", success: function (xml) { var points = []; var bounds = new google.maps.latlngbounds(); $(xml).find("trkpt").each(function () { var lat = $(this).attr("lat"); var lon = $(this).attr("lon"); var p = new google.maps.latlng(lat, lon); points.push(p); bounds.extend(p); }); var poly = new google.maps.polyline({ //style path: points, strokecolor: "#ff0000", //strokecolor: "#fb9d00", //orange strokeopacity: .7, strokeweight: 4 }); poly.setmap(map); // fit bounds track map.fitbounds(bounds); } }); // gpx - end

works fine me in google chrome. track displayed should. however, firefox doesn't show track. if set url url: "path/to/url" works fine in firefox.

i think it's problem localstorage.getitem('gpxurl') can't find working solution.. ideas how solve this? thanks!

javascript jquery ajax

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -