Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

localhost :: cross domain ajax

Tags:

ajax

localhost

Is there any way to tell your localhost that it can do cross domain ajax calls?

I need this for my testing.

If it is a browser specific issue i am using google chrome.

Cheers.

like image 492
Hailwood Avatar asked Oct 03 '10 09:10

Hailwood


People also ask

Can you do cross domain Ajax?

For a successful cross-domain communication, we need to use dataType “jsonp” in jquery ajax call. JSONP or “JSON with padding” is a complement to the base JSON data format which provides a method to request data from a server in a different domain, something prohibited by typical web browsers.

What is cross domain violation Ajax?

A common problem for developers is a browser to refuse access to a remote resource. Usually, this happens when you execute AJAX cross domain request using jQuery Ajax interface, Fetch API, or plain XMLHttpRequest. As result is that the AJAX request is not performed and data are not retrieved.

How do I create a cross origin Ajax request?

For instance, if sending a request from http://www.example.com, any of the following would be "cross origin": http://mail.example.com (domain differs) https://www.example.com (protocol differs) http://www.example.com:8080 (port differs)

What is cross domain URL?

What's a cross-domain redirect? If you have a cross-domain redirect set up, that means that once someone clicks your ad, he or she will pass through a website with a different domain (for example, the “example.com” in “www.example.com”) before or after reaching your landing page.


1 Answers

It's very possible. Let's start with a dev browser.

Step 1: Download Chromium

Windows -- http://www.chromium.org/getting-involved/download-chromium

Mac -- http://www.macupdate.com/app/mac/36244/chromium/

There should be a build ready to go, but these locations change over time. So if these end up with 404's do a Google search for Windows Chromium Download and you'll find it.

Step 2: Then run the executable with this flag after it. --disable-web-security

Windows -- Create a shortcut to the executable and tag this in the Properties. Or run from [CMD].

Mac -- Open up a terminal and run this straight from there with the flag.

And, you should be good to go. I also setup a quick Apache service and run through a 127.0.0.1 configured domain, but localhost should be just fine. Here's proof.

Cross-domain security block disabled

I hope this helps you!

like image 148
phillihp Avatar answered Oct 10 '22 09:10

phillihp