Google streetview with data on remote server? (ajax, jsonp) - google-maps

Have a look at my Google custom streetview player implementation (simplified for testing): http://www.detestserver.de/sameserver/start.html
It works well as long as the player.js and the test.php file (for the data) are on the same server.
Data is still retrieved, but display fails when the test.php file is on another server:
http://www.detestserver.de/differentservers/start.html
Even with "async: false" in the ajax call for the jsonp.
What's wrong?
Thanks.

It looks like the problem is cross-domain Ajax. You can try the following:
crossdomain - Ajax
After seeing your debug screen are you trying to retrieve Google tiles directly? I'm not sure about StreetView but with map tiles they take active steps to prevent them being downloaded from third-party applications so it may be that your referrer code is being blocked.

Related

Google Maps API for both localhost & production server, as of April 2019

TLDR
My code works fine on my laptop when accessed as file://<path>/index.html, but neither on my laptop with an Apache server running when accessed as http://<path>/index.html, nor on my real (production) server. I see no errors on the console, but the map is just a grey rectangle.
[Update] I moved to LeafletJS shortly after asking this question, and recommend others to do so too.
It has been a few years since I coded any Google Maps applications.
It seems that, as of last year, it is now necessary to have an API key, by providing it with credit card details, and to provide it with each API call.
Unfortunately, there is a lot of of information about this, much/most of it out of date and/or contradictory.
Can anyone point to the canonical guide, preferably with screenshots, of how to configure this?
I wish to draw a map, and add some makers, which will require reverse geocoding, such that I provide a street address and convert it to lat/long in order to place the markers.
Sounds simple enough, but which of the many thousands of "helpful" site has gotten it right?
For instance, what seems to be the current Google help page speaks of
From the Navigation menu, select APIs & Services > Credentials.
On the Credentials page, click Create credentials > API key
But I can't even see that menu option :-(
[Update] If it helps any, the error message in the developer console said :
Geocoding Service: You must use an API key to authenticate each request to Google Maps Platform APIs. For additional information, please refer to http://g.co/dev/maps-no-account For more information on authentication and Google Maps JavaScript API services please see: https://developers.google.com/maps/documentation/javascript/get-api-key
[Update] I am trying to access the API like this
<script src="maps.google.com/maps/api/…>
and
var url = 'https://maps.googleapis.com/maps/api/geocode/json?address=' + comapnyLocation +'&key=XXXX';
$http.get(url)
[Update++] in the developer console, I see a bunch of errors along the lines of:
aliextension.com/wp-content/uploads/2017/08/JAR.png:1 GET https://aliextension.com/wp-content/uploads/2017/08/JAR.png net::ERR_CONNECTION_TIMED_OUT
I have no idea what aliextension is, nor does it appear in my code (maybe in some minified JS?)
Ok, it is something to do with AliExpress (Ali Baba). I removed it & the timeout messages go away, but I still have problems.
If I load the index.html into Chrome as a file://, then it works just fine. But, if I load it `as http://, where I have a Xampp Apache server running, the map box remains grey, although I see no error messages. The same thing happens on my real server :-(
This page should be your starting point:
https://developers.google.com/maps/documentation/javascript/tutorial
it helps you working with Google map javascript API.
To embedded a google map to your website read the overview page in the above link.
To add markers to your google map read this page:
https://developers.google.com/maps/documentation/javascript/adding-a-google-map
To do reverse geocoding read this page:
https://developers.google.com/maps/documentation/javascript/geocoding
That all i need to work with google map. I think you can do the same too.
The cause for this is quite likely an API key restriction.
In order to permit these host-names or IP addresses, you have to:
a) go to the credentials panel and select the according project, then click on "Api key".
b) there you can loosen the restrictions, for HTTP referrers (for web-sites)
... or for IP addresses (in case these are server-side requests).

Access Google Maps API json in browser

Silly question I am sure.
But how can I access this for simple testing but also whilst inside a phonegap which has no URL directly through the browser:
https://maps.googleapis.com/maps/api/geocode/json?address=122+flinders+st,+darlinghurst,+nsw,+australia&sensor=false&key=API_KEY
I have of course changed the API key which is a browser key. I have also changed my Referers: * So everything should be allowed.
Try this. It's a very simple phonegap maps api example.
One option is to use the Advanced REST Client Plugin which is free and you can install it on your chrome browser. This plugin opens directly in browser tab and you can set the request in a huge text box, set the type of request (GET, PUT, POST, DELETE etc) and also the parameters if required. You can see the results in below when you hit submit.
This Plugin is exclusively made for testing purposes relating to matter like sending a request to an API and then getting the results back from it in either JSON or XML format.
Click this link in order to install it in your Chrome Browser.
Hope that Helps!!

Chrome data compression proxy error

When I use youtube video upload API on mobile phone it uploads the video but before redirect to the redirect_url, most of the times it throws this error:
url with error: http://uploads.gdata.youtube.com/action/FormDataUpload/FSVfvf45g45g4FFDSGSdfgr24g3t34t3EFVFFDSFGgg3435?nexturl=http://my-redirect-url.com:80/uploaded
This page cannot be loaded via the chrome data compression proxy. Try reloading this page.
when I just reload the page it redirects to the right redirect_url and the video is uploaded appropriately.
What might be a solution to fix this error?
I am the tech lead for the Chrome data compression proxy. We happen to have some special case logic to deal with YouTube URLs in the proxy which would cause this, but this seems not to be working as expected. Can you give me an example of your use of the API? Is this a POST request? Seems like something we should be able to fix.
Youtube or Google updated something in apps/youtube_api (unclear what) but when I accesses the app console it was different, then I created a new app and it worked.

Chrome Extension with XMLHttpRequest slow at launch

At the moment I am developing a Google Chrome Extension in which I have to fetch data from a server. I am doing this with an XMLHttpRequest and all is going well, except for the fact when I launch Google Chrome and immediately click my extension, it won't open until the XMLHttpRequest is completed. The request is sent to a rather slow server, that's where the problem is. But is there a way in which you might run the XMLHttpRequest in another thread or does Google Chrome give you another way to fetch data from a server that runs in the background so I can open my extension while it's still getting it's data from the server?
Maybe good to know, the XMLHttpRequest runs in the background page, not the popup page.
Looks like the Asynchronous parameter has to be set to true.

Google maps API v3 flash empty viewport

I'm using the google maps API v3 with flash and it works fine on one of my websites.
I transfered it to another website and changed the API key, but all I see is the default background color with no error message. Unfortunatly, I cannot access the flash source code.
Is there a way to debug the application or see some error messages without the source code?
Or maybe somebody has an idea of what is wrong?
Use Firebug Net monitor to see if all of the request are going through. That would be the first place that I would start. My guess is that there are HTTP Requests trying to get data from a domain that doesn't have a crossdomain policy allowing access from the new site you moved it to.
First of all maps V3 doesn't need a a key. I think you are combining parts of V2 (with key) and V3(which doesn't need key) so obviously there is something wrong in your code.