Can't load google map Geojson data in IE 9 - javascript

I'm getting the below error when trying to load GeoJson data in a map in IE9 using Javascript
Object doesn't support this property or method
My method call looks like below
myMap.data.loadGeoJson('https://storage.googleapis.com/maps-devrel/google.json');
I believe it has something to do with the .data call, as the only lines it happens on are ones that include .data in them. The "myMap" variable is initialized and set to a google map, and that all works fine, it's just when I try to load the geojson that it breaks.
Does anyone know why it would be breaking in IE9?
I've also attached a shot from Browserstack on similar errors using the google demo page...
UPDATE: I've talked to a google developer directly and it seems like a bug currently with IE9 (and I believe 8 as well), loading geojson does not work. If anyone does find a workaround though, it would be greatly appreciated. Even just knowing exactly why it's breaking would be good...

I had the same problem with IE.
Try this:
Open IE, Open "Tools", click on "Compatibility View Settings" and then uncheck "disable intranet sites in Compatibility View Setting" and then try to open your page.
That worked for me.

The sample code loads the GeoJSON from a different server (cross-domain).
The problem is that .loadGeoJson() is using XMLHttpRequest to load the data, and on IE8 and IE9 this doesn't work cross-domain.
This is the "Access is denied" error you can see in the console.
Try putting the GeoJSON on the same server.
Or, if you really need to load GeoJSON cross-domain and support IE9, use an ajax library, and the .addGeoJson() method. It would look something like this using jQuery:
$.ajax({
url: myURL,
dataType: 'json',
success: function(geojson) {
myMap.data.addGeoJson(geojson);
}
// Other options to configure for jsonp, etc.
});

Related

Getting JSON from a website with no visible files using p5.js

I am trying to import a json file from a website using p5.js, and i thought it would be quite easy, however when i tried it i realized the json was actually just in plain text on the page (It is the only thing on the page). I checked chrome web tools to look at index.html, but i was greeted by "(index)", is it a problem with google or am i just going to have to use something else than this?
function preload() {
httpGet('leaderboard.popcat.click', 'json', function(response) {
});
}
//there are the setup and draw functions aswell
I got an error when i ran the code aswell, it was
Error: JSONP request to url failed
here is a picture of the page btw, (the url is leaderboard.popcat.click)
EDIT: The main problem i am having is that there is no file in https://leaderboard.popcat.click/, not the getting of json.
The network tab says no such url exists, and i believe that is because of the fact that i didn't specify a file.
Here is the console output aswell
I solved my issue by starting chrome in no-cors mode or whatever it's called AND using the full path of the website. I got it into no-cors mode by making a shortcut with this link
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --disable-web-security --user-data-dir=~/chromeTemp"
and running it as an administrator

IE8 AJAX error: javascript is not loaded

I have a fairly complicated page built using JSP, JavaScript, jQuery, and css. It works fine in Chrome, Firefox, and IE10. However, it doesn't work in IE8 - JavaScript specific to that particular page doesn't load, the HTML is broken, some css is loaded, but not all.
The page called via an AJAX call:
jQuery.ajax({
url : url,
dataType: "html",
cache : false,
beforeSend : ...
Capturing network activity in Developer tools shows that the relevant script files have started to arrive, but only 155B-157B were received. Result code is 304, time is shown as under 1ms.
Same reporting for Chrome shows that the same JS files are 3-7-12KB in size, took 3-10ms to arrive, with HTTP code 200.
The same page requested via a regular GET request loads normally.
The problem looks like a known aggressive-caching issue in IE8, but somehow setting cache : false doesn't prevent 304 from happening.
How can I make this work?
Using jQuery version 1.4.2, IE8 on Win7. tc Developer server 2.8.2.
One of the JavaScript files being retrieved via the AJAX call contained, among other code, this method:
jQuery(document).ready(function() {
return validate...();
}
IE8 was not able to process it, and discarded all surrounding JavaScript.
I removed the lines above, and moved the validation method to the function that was called on Complete: of that AJAX call, and everything started working.

jPlayer complains about valid swfPath

Major update at end of post
I'm initializing jPlayer with the following code. It's working great on all modern browsers and on mobile devices.
$("#jquery_jplayer_1").jPlayer({
supplied: "mp3",
swfPath: "/js/jQuery.jPlayer.2.4.0",
solution: "html,flash",
errorAlerts: true,
ended: function () {
console.log('ended event fired');
$.getScript('/js/random_show.js.php');
}
});
However testing in IE 8 and IE 7 I get the following error from the fallback SWF player:
If I open mysite.com/js/jQuery.jPlayer.2.4.0 the SWF loads without issue. I have tried letting the page sit for a while to see if that helped. It does not.
Per suggestion tried with working URL but have same error now with complete path listed. Path taken from browser after loading swf so most definitely correct. I had pasted code here but SO objected to body of post containing the URL... Here is new error message.
Another update: Tried linking directly to copy of SWF hosted by jPlayer per Josh D suggestion below. Same error. Upgraded to 2.5.0 from 2.4.0. Same error.
How can I get the fallback working?
Major update 12/12/2013
I have set up a sandbox copy of the site here: http://www.itsneworleans.dreamhosters.com/shows/happy-hour Hit Listen to see error message.
I have eliminated the HTML5 solution and use only the Flash. This allows any browser to trigger the error.
After dismissing the error Chrome debugger reports a 200 status for the swf so this is not a 404 swf problem. Anyone have an idea re this error?
After error below is dismissed.
Chrome error message
I added a jPlayer.ready() function with console output to my initialization. I found it only fired when the player was already visible AND there was no complaint about the Flash solution not being found.
After some more searching based on that result I found this post:
"check your styles. if your #jquery_jplayer_1 or its parent has
display=none, ready event never fires in such browsers as opera or
firefox. i mean flash object can't be hidden."
What was happening was that jPlayer's Flash solution was failing to load because my player had display set to none.
So now I have offscreened player via a negative margin-top and instead of animating height I animate margin-top. It's all working now.
Give the absolute path of your swf folder like www.mysite.com/js/jQuery.jPlayer.2.4.0.
This will help you to test whether the swfPath you gave is wrong or something else.
Did you try using swfPath: "http://jplayer.org/2.5.0/js/" instead?
If directly going to the path in your browser works and yet it doesnt work inside the script. It could be either:
MIME types - check if .swf is being served as application/x-shockwave-flash
Same origin (cross-domain) policy security, is the .swf file and the executing JS file located in the same domain and being served under the same protocol (HTTP and HTTPS).
If you are willing to post a demo link, we should be able to debug it.
just write "../js/jQuery.jPlayer.2.4.0" instead of this it will give you proper solution.
I face same issue in JWPlayer and its worked like this.

jQuery form plugin - iframe problem

Here I am, with another problem. :) Maybe this time I'll get some responses. :P I'm using jquery.form.js plugin, to process forms with file fields. It's simple implementation.
$this.ajaxSubmit({
data: { 'ajax' : 'true' },
dataType: 'html',
success: parseRsp,
error: parseErr
});
It works on Chrome, Opera and new Firefoxes. It doesnt on Firefox 3.x and all versions of IE. Plugin throws some Server abort problem, but after some changes in code to debug it, I get it. Function getDoc(iframe) throws Permission denied in IE. But why? It's not cross-domain or something? I even add <script>document.domain = 'mydomain.com';</script> but that doesn't work either. Any ideas?
BTW. we are using APE Project. It probably makes some document.domain modifications, but on Chrome console, on page where is form, when I type document.domain i'm still getting mydomain.com, so...
I had a similar issue just now.
The problem was that I was setting the document.domain property in the parent document. The api document that is inside the iframe is vanilla json, and, as such, has no opportunity of setting a document.domain. Hence the permission issue.
So I had to remove the document.domain assignment from the parent.

(NS_ERROR_DOCUMENT_NOT_CACHED) through firefox same code works for safari

I am getting (NS_ERROR_DOCUMENT_NOT_CACHED) error when I try to access the Javascript code through firefox.I get this error in the contents tab of HTTPFOX.
I googled and set the parameters of browser in config file as specified in this site but it still doesn't work.
http://code.google.com/p/httpfox/issues/detail?id=20
Can somebody suggest whats going wrong since the same code works fine for safari browser..
If anyone is interested in a solution to this, I believe it's to do with the plugin noscript. Disabling it fixed this, but I have yet to work out what part of noscript was causing the issue. Will update if I find out.
Edit:My issues was with a twitter auth callback. In the Advanced settings of noscript under ABE, in the SYSTEM ruleset, on the line "Accept from LOCAL" I added "*.twitter.com". This allowed callback requests from *twitter.com to return to a local address.
On my macbook I had to uninstall firefox completely to correctly get the content of an ajax response with httpfox. This also implies to remove the firefox profile bij removing this Firefox folder (I could only find it via the terminal and not via Finder):
/Users/<YOURUSER>/Library/Application Support/Firefox
Then install firefox again and install the httpfox add-on.
I tried many cache settings also by entering about:config in the firefox URL however without succes. Be aware that removing the profile settings like I describe will also remove all your personal firefox customization. It concerned firefox 18.0.2 and httpfox 0.8.11.
We used to get the same error when our JavaScript made an XMLHTTPRequest to the server. On the server side, we had java, and the java response, the content type was not explicitly set to "text/html". When that was done
resp.setContentType("text/html");
the error went away.

Categories