M
M
Maxim2015-04-01 21:48:56
JavaScript
Maxim, 2015-04-01 21:48:56

How to access secure url google api from localhost?

How to access a secure url via https from localhost?
Now I'm getting an error when I make a request.

XMLHttpRequest cannot load https://maps.googleapis.com/maps/api/place/details/json?v=3&sensor=true&pla…id=ChIJpewiaQSX30ARTSgExNHsPos&key=******. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:9000' is therefore not allowed access.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Rulev, 2015-04-02
@Rulexec

To access the Google API from any domains, go to the console , open your project, go to APIs & auth → Credentials on the left, click Edit allowed referers for your key and specify something like localhost:9000/*.
In general, for all sites legally - no way.
But locally, if you have Google Chrome , you can run it with the --disable-web-security. Or search the store for an extension like "Allow-Control-Allow-Origin".
For other browsers, there are also different analogues.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question