same-origin-policy

Make a Cross-Domain request for XML from a local file

泪湿孤枕 提交于 2019-12-02 03:03:22
I am not sure if this is even possible. Basically I want to load a local html file on a client PC and have it make a request to a remote server. The data served up by the server is XML. When I say I am loading a file, I mean the URL in chrome appears as "file:///E:/..." This is the closest I have gotten to being able to load the XML. I inspected the network tab on the client end and its successfully loading, I just cant seem to get the XML into an element I can inspect: var script = document.createElement('script'); script.setAttribute('src', 'http://xxx.xx.xx.xxx:xxxx/myxmldata'); script

Get JSON from subdomains with jQuery

五迷三道 提交于 2019-12-02 02:15:55
问题 I have user1.mydomain.com and user2.mydomain.com domains. I use api.mydomain.com to deal with my web app over AJAX/JSON. So, I want to make a POST request from user1.mydomain.com to api.mydomain.com/projects using jQUery something like this: {'action':'getActiveProjects'} to get list of active projects for user1 in JSON as a result. I found $.getJSON method but it seems there is no option for sending some data to server, just GET method. The other problem I face is same origin policy. So, how

Make a Cross-Domain request for XML from a local file

空扰寡人 提交于 2019-12-02 02:05:58
问题 I am not sure if this is even possible. Basically I want to load a local html file on a client PC and have it make a request to a remote server. The data served up by the server is XML. When I say I am loading a file, I mean the URL in chrome appears as "file:///E:/..." This is the closest I have gotten to being able to load the XML. I inspected the network tab on the client end and its successfully loading, I just cant seem to get the XML into an element I can inspect: var script = document

When should I really set “Access-Control-Allow-Credentials” to “true” in my response headers?

孤街浪徒 提交于 2019-12-02 01:13:57
问题 MDN says, when the credentials like cookies, authorisation header or TLS client certificates has to be exchanged between sites Access-Control-Allow-Crendentials has to be set to true . Consider two sites A - https://example1.xyz.com and another one is B- https://example2.xyz.com. Now I have to make a http Get request from A to B. When I request B from A I am getting, "No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://example1.xyz.com' is therefore

When should I really set “Access-Control-Allow-Credentials” to “true” in my response headers?

蹲街弑〆低调 提交于 2019-12-01 20:19:36
MDN says, when the credentials like cookies, authorisation header or TLS client certificates has to be exchanged between sites Access-Control-Allow-Crendentials has to be set to true . Consider two sites A - https://example1.xyz.com and another one is B- https://example2.xyz.com . Now I have to make a http Get request from A to B. When I request B from A I am getting, "No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin ' http://example1.xyz.com ' is therefore not allowed access." So, I'm adding the following response headers in B response.setHeader("Access

Google Drive API, can't open standard sharing dialog via JS (x-frame-options error)

ぃ、小莉子 提交于 2019-12-01 06:36:24
I have a JavaScript app which uses the Google Drive API. I read how to open a standard sharing dialog here: https://developers.google.com/drive/web/manage-sharing <head> ... <script type="text/javascript" src="https://apis.google.com/js/api.js"></script> <script type="text/javascript"> init = function() { s = new gapi.drive.share.ShareClient('<MY_APP_ID>'); s.setItemIds(["<MY_FILE_ID>"]); } window.onload = function() { gapi.load('drive-share', init); } </script> </head> <body> <button onclick="s.showSettingsDialog()">Share</button> </body> Seems like I do everything right, when I click my

What's the point of the Anti-Cross-Domain policy?

China☆狼群 提交于 2019-12-01 04:22:27
Why did the creators of the HTML DOM and/or Javascript decide to disallow cross-domain requests? I can see some very small security benefits of disallowing it but in the long run it seems to be an attempt at making Javascript injection attacks have less power. That is all moot anyway with JSONP, it just means that the javascript code is a tiny bit more difficult to make and you have to have server-side cooperation(though it could be your own server) The actual cross-domain issue is huge. Suppose SuperBank.com internally sends a request to http://www.superbank.com/transfer?amount=100&to=123456

JavaFX WebView disable Same origin policy (allow cross domain requests)

点点圈 提交于 2019-12-01 04:05:16
I'm developing a JavaFX application that is mostly a glorified web page. It's a desktop application (it's no embedded into a web page) and it has a Web View for the main UI. The application itself serves the sole purpose of accessing Bluetooth devices using Bluecove because that's not possible directly with JavaScript on a web browser. The proof of concept works ok (I was able to call JavaScript code from Java and vice-versa) but I have one extra requirement of calling arbitrary web services/API from within JavaScript but this violates the same origin policy (similar to this on Android: Allow

JavaFX WebView disable Same origin policy (allow cross domain requests)

本小妞迷上赌 提交于 2019-12-01 01:49:56
问题 I'm developing a JavaFX application that is mostly a glorified web page. It's a desktop application (it's no embedded into a web page) and it has a Web View for the main UI. The application itself serves the sole purpose of accessing Bluetooth devices using Bluecove because that's not possible directly with JavaScript on a web browser. The proof of concept works ok (I was able to call JavaScript code from Java and vice-versa) but I have one extra requirement of calling arbitrary web services

What's the point of the Anti-Cross-Domain policy?

依然范特西╮ 提交于 2019-12-01 01:18:34
问题 Why did the creators of the HTML DOM and/or Javascript decide to disallow cross-domain requests? I can see some very small security benefits of disallowing it but in the long run it seems to be an attempt at making Javascript injection attacks have less power. That is all moot anyway with JSONP, it just means that the javascript code is a tiny bit more difficult to make and you have to have server-side cooperation(though it could be your own server) 回答1: The actual cross-domain issue is huge.