简体   繁体   中英

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM