Qvatra
Qvatra

Reputation: 3857

HTTPS request from javascript

How to send https request to address https://www.googleapis.com/plus/v1/people/me from java script and most important how to get data from server?

I need it to identify users e-mail in my packaged chrome app.

Upvotes: 0

Views: 1221

Answers (1)

krisk
krisk

Reputation: 7117

Note that this would violate the same origin policy. Additionally, the whole point of HTTPS is so that the whole page (and request cycle) is secure.

The alternatives would be:

  1. Make the request using JSONP, or

  2. Set up a proxy: let your JS call your own server on the same origin, which will in turn make an HTTPS request, or

  3. Have an iframe which points to an HTTPS page (on your own server). This page should then be able to make Ajax requests to the server over HTTPS. Using the HTML5 postMessage API, you can then post a message back to the parent window.

Upvotes: 1

Related Questions