Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7438955
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:37:59+00:00 2026-05-29T10:37:59+00:00

XMLHttpRequest s require CORS to work cross-domain. Similarly for web fonts, WebGL textures, and

  • 0

XMLHttpRequests require CORS to work cross-domain. Similarly for web fonts, WebGL textures, and a few other things. In general all new APIs seem to have this restriction.

Why?

It’s so easy to circumvent: all it takes is a simple server-side proxy. In other words, server-side code isn’t prohibited from doing cross-domain requests; why is client-side code? How does this give any security, to anyone?

And it’s so inconsistent: I can’t XMLHttpRequest, but I can <script src> or <link rel> or <img src> or <iframe>. What does restricting XHR etc. even accomplish?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T10:38:00+00:00Added an answer on May 29, 2026 at 10:38 am

    If I visit a malicious website, I want to be sure that :

    1. It cannot read my personal data from other websites I use. Think attacker.com reading gmail.com
    2. It cannot perform actions on my behalf on other websites that I use. Think attacker.com transferring funds from my account on bank.com

    Same Origin Policy solves the first problem. The second problem is called cross site request forgery, and cannot be solved with the cross-domain restrictions currently in place.

    The same origin policy is in general consistent with the following rules –

    • Rule 1: Doesn’t let you read anything from a different domain
    • Rule 2: Lets you write whatever you want to a different domain, but rule #1 will not allow you to read the response.
    • Rule 3: You can freely make cross-domain GET requests and POST requests, but you cannot control the HTTP headers

    Lets see how the various things you have listed line up to the above rules :

    1. <img> tags let you make a HTTP request, but there is no way to read the contents of the image other than simply displaying it. For example, if I do this <img src="http://bank.com/get/latest/funds"/>, the request will go through (rule 2). But there is no way for the attacker to see my balance (rule 1).

    2. <script> tags work mostly like <img>. If you do something like <script src="http://bank.com/get/latest/funds">, the request will go through. The browser will also try to parse the response as JavaScript, and will fail.

    3. There is a well known abuse of <script> tags called JSONP, where you collude with the cross-domain server so that you can ‘read’ cross-domain. But without the explicit involvement of the cross-domain server, you cannot read the response via the <script> tag

    4. <link> for stylesheets work mostly like <script> tags, except the response is evaluated as CSS. In general, you cannot read the response – unless the response somehow happens to be well-formed CSS.

    5. <iframe> is essentially a new browser window. You cannot read the HTML of a cross-domain iframe. Incidentally, you can change the URL of a cross-domain iframe, but you cannot read the URL. Notice how it follows the two rules I mentioned above.

    6. XMLHttpRequest is the most versatile method to make HTTP requests. This is completely in the developers control; the browser does not do anything with the response. For example, in the case of <img>, <script> or <link>, the browser assumes a particular format and in general will validate it appropriately. But in XHR, there is no prescribed response format. So, browsers enforce the same origin policy and prevent you from reading the response unless the cross domain website explicitly allows you.

    7. Fonts via font-face are an anomaly. AFAIK, only Firefox requires the opt-in behavior; other browsers let you use fonts just like you would use images.

    In short, the same origin policy is consistent. If you find a way to make a cross-domain request and read the response without explicit permission from the cross-domain website – you’ll make headlines all over the world.

    EDIT : Why can’t I just get around all of this with a server-side proxy?

    For gmail to show personalized data, it needs cookies from your browser. Some sites use HTTP basic authentication, in which the credentials are stored in the browser.

    A server-side proxy cannot get access to either the cookies or the basic auth credentials. And so, even though it can make a request, the server will not return user specific data.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web application that adds contextual information to XmlHttpRequest objects using the
I have this code: require(class.XMLHttpRequest.php); function hot($news){ $url=https://localhost/search.aspx?search=.$news.; $ajax=new XMLHttpRequest(); $ajax->setRequestHeader(Cookie,Cookie: host); $ajax->open(GET,$url,true); $ajax->send(null);
I'm creating a class to create and delete folders and some other things I
I have the following codes: require(class.XMLHttpRequest.php); function hot($news){ $url=https://localhost/search.aspx?search=.$news.; $ajax=new XMLHttpRequest(); $ajax->setRequestHeader(Cookie,Cookie: host); $ajax->open(GET,$url,true);
XmlHttpRequest works through callbacks. So how can I return a value? I tried to
I use a XMLHttpRequest on a signup form to see if the username they
I am using an XMLHttpRequest to POST a JSON string to PHP. The JSON
In the XMLHttpRequest Spec it says that: The DONE state has an associated error
I have a XMLHTTPRequest that contains SOAP message. I want to add guid that
I've been using synchronous XMLHttpRequest with responseType set to arraybuffer for quite a while

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.