same-origin-policy

modify getJSON to work with CORS

拈花ヽ惹草 提交于 2019-12-24 12:12:35
问题 I am looking for ways to allow cross-domain access using $.getJSON. I came across solutions which suggest that using CORS is the solution to this problem. But most of the solutions have a general ajax format. I cannot use JSONP since I get data from a server which I do not have access. Is there a way to modify this code using $.getJSON to get the data? $.getJSON(jsonURL, function(res){ console.log(JSON.stringify(res)); }); Or do I have to use ajax format for CORS? 回答1: Server which I do not

JavaScript solution to detect if third party cookie is disabled [duplicate]

喜夏-厌秋 提交于 2019-12-24 11:43:52
问题 This question already has answers here : Check if third-party cookies are enabled (5 answers) Closed 5 years ago . My ultimate requirement is to detect if third party is enabled for the client browser because my payment gateway has a different scenario for browsers with disabled third party cookies. I tried setting up google cookies from within an iframe within my page as below: <iframe src="http://www.google.com" frameborder="0" style="border:0; display:none;"></iframe> and was able to

Access Control Allow Origin header not present with fetch api call

会有一股神秘感。 提交于 2019-12-24 05:06:35
问题 So I'm trying to use isomorphic-fetch https://www.npmjs.com/package/isomorphic-fetch I have a server written in go that is giving back JSON data. This is how I'm making the call - export function fetchDistricts(geoState) { return function (dispatch) { dispatch(requestDistricts(geoState)); return fetch(`http://localhost:8100/districts/`) .then(response => {console.log(response);}) .then(json => { console.log("json"); }); } I get this error in the chrome console Fetch API cannot load http:/

Can I use the same HTML5 browser storage, across different domains?

有些话、适合烂在心里 提交于 2019-12-24 04:15:08
问题 There are a couple of different approaches for choosing an HTML5 browser storage (IndexedDB, Web Storage), but from what I read in the spec, the "same origin policy applies". Is there a way to keep data inside the browser and have it available from both www.domain1.com/myapp1 and www.domain2.com/myapp2? 回答1: Cross-Document Messaging You can use a technique called cross-document messaging to accomplish this. There is an article here that outlines how to implement it, but it's basically where

Iframes and Same-Origin-Policy and reverse proxy hack

◇◆丶佛笑我妖孽 提交于 2019-12-24 02:59:05
问题 I have been reading up on Iframes with different domains then the parent document and I am slightly confused. I understand that if the Iframe is from the same domain as its parent document, the parent document can access the iframe's document. It seems like I could circumvent this with the following hack: I set up a web server at mydomain.com I serve the original page from mydomain.com/index.html I setup a proxy on my webserver for mydomain.com/othersite -> site2.com Add <iframe src="mydomain

What to do when an API doesn't allow Access-Control-Allow-Origin

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-23 18:56:37
问题 I'm driving crazy with all this same-origin-policy thing. When I try to do a request to the Google Maps API I have no problems: var jsonData = $.ajax({ url:"http://maps.googleapis.com/maps/api/geocode/json?address=", dataType:"json", async:true, success: function(json){...} } I think that is because Google Maps API allow Access-Control-Allow-Origin. But when I try to use the openls.geog.uni-heidelberg.de API I get the cross-origin error: var xmlData = $.ajax({ type: "GET", url:"http://openls

JSON Proxy in Java / Play! Framework

自作多情 提交于 2019-12-23 12:26:40
问题 I have a Play! application and from the JavaScript we now have run in to the Same Origin Policy Problem. What I want is that JavaScript ajax calls go to our own server and that this server again route the json call to the external REST API. My JavaScript use ajax to this url: $.getJSON("http://mydomain.com/users", function(users) { //callback }); How can I easly make the server route to lets say: public void getUsers(){ // result = call www.otherdomain.org/api/users.json What to do here?

Laravel Response::json gives cross domain error i browser even if header is Access-Control-Allow-Origin:*

血红的双手。 提交于 2019-12-23 04:43:21
问题 I got this Laravel 4 problem that is really confusing to me. I Created these two methods on the same controller. The controller in declared to be restful. The ajax request is from a different domain. Does not work public function getOwnlist(){ $test = User::with(array("images", "images.category"))->find(Auth::user()->id); return Response::json($test, 200, array('Access-Control-Allow-Origin' => '*')); } Works public function getLatest(){ $images = DB::table("images")->where("public","=","1")-

access-control-allow-origin on playframework

走远了吗. 提交于 2019-12-23 01:43:28
问题 How can I get playframework to allow non-origin calls? I have tried adding a @Before method to a controller, but that never gets called by an ajax client. @Before public static void setCORS() { Http.Response.current().accessControl("*", "GET,PUT,POST,DELETE", true); } I am trying to setup a test API server for client developers to test against, but that seems to require disabling the Origin restriction. Has anyone else got this working? or accomplished this in a different way? UPDATE: I found

Cross Origin Chrome Extension

孤者浪人 提交于 2019-12-22 06:38:05
问题 I have been reading and playing around with Chrome Extensions for the last week or so but I'm having trouble trying to achieve what I want. What I am trying to create is an Extension that in the background (or silently) visits a website fills out a form on the web page and retrieves the response. The website doesn't have an API and I can't create a server to do this as the website only allows X requests per IP per hour so my requests would be exhausted after a few users. So my idea was to