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 8305655
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T18:09:40+00:00 2026-06-08T18:09:40+00:00

The thing is that it works when script is on a page, that is

  • 0

The thing is that it works when script is on a page, that is normally fetched from the net, but when code lies in userscript, that is as a part of plugin, suddenly it forgets that there is Access-Control-Allow-Origin: * header and stops responding to cross domain requests.

Here is some code that illustrates this:

// ==UserScript==
// @include     *nasa.gov*
// ==/UserScript==

var xhr = new window.XMLHttpRequest();
xhr.onreadystatechange = function () {
  alert('state changed: ' + this.readyState + "\nstatus: " + this.status);
};
xhr.onload = function(){
  alert('document loaded');
};
xhr.open('GET','http://apod.nasa.gov');
xhr.send(null);

I’ve chosen apod site since it has not got b&w of modern websites, so there is no need to filter events.

And in this state it works, ok but when I point this url to my server which accepts call from every site, it ignores allow-origin header…

Ok, is it a bug, or I’m doing something wrong here ? Maybe some option on request object to ‘assure’ it that it is ok to go there ?. I don’t know like xhr.allowcrossdomainaccess = true or whatever ?

  • 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-06-08T18:09:41+00:00Added an answer on June 8, 2026 at 6:09 pm

    (You’ve already figured this out – but just to give this question a proper Answer..)

    Injected scripts run in the page with (mostly) normal security privileges – same as page scripts do. Hence, you won’t typically be able to do cross-domain requests from injected scripts.

    Also see https://stackoverflow.com/a/9614760/163549 for CORS implementation status in Opera.

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

Sidebar

Related Questions

I have a cool snippet of code that works well, except one thing. The
Funny thing is that if i delete the comment for alert(data[i].id) the code works.
One thing that really bothers me about Google Code is that fact that it
I have an application script that is working correctly, but I have a few
I'm running into a problem that I can't seem to solve. The code works
I have a login script for a small application that works by storing session
I have a page that has a series of "related" selects. Everything works fine
GLSL has a full C-style preprocessor. The only thing that does not work is
I used to work in JavaScript a lot and one thing that really bothered
I have a ListView where I would like to display things horizontally. That works

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.