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

  • Home
  • SEARCH
  • 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 8720463
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:02:48+00:00 2026-06-13T07:02:48+00:00

I keep having this doubt in my mind, I want to test if an

  • 0

I keep having this doubt in my mind, I want to test if an URL exists before loading the script from that URL, but the way I’m trying to do it fails, as I’m using XMLHTTPRequests and as many know, when you use this method to GET a file from a server that it’s not the same as the script that executes the GET, you will get back is not allowed by Access-Control-Allow-Origin .

So how come Modernizr.load() method can theoretically load the scripts and I cannot even see if there’s actually something there ?

  • 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-13T07:02:49+00:00Added an answer on June 13, 2026 at 7:02 am

    Because Modernizr.load(), like @dm03514 mentions, loads the script not through XMLHttpRequest, but by inserting a <script tag which doesn’t have the cross-domain restriction. It then tries to check if the script loaded correctly, but that’s not an easy task and it may not be possible in all browsers. For more detail you can see this recopilation of the support of different browsers for the various options available for checking success of loading scripts/css: http://pieisgood.org/test/script-link-events/

    As for why XMLHttpRequest fails, you can read more about cross-domain restrictions at MDN: https://developer.mozilla.org/en-US/docs/HTTP_access_control

    Some motivations for using script loaders are:

    1. Loading scripts based on conditions like what yepnope and YUI do
    2. Load scripts asynchronously for performance reasons ( tags block the rendering of the page).
    3. Dependency injection (load resources that other scripts need, this is what requirejs does)
    4. Load scripts when certain events happen (load hew functionality when a user clicks on a tab)

    Also when you use script loaders, you usually load everything from them, including your application code, so that your application code has access to all dependencies. The require.js model (google AMD modules) is a great way of organizing your app. It allows you to write small modules that do specific tasks and reuse them, instead of one big file that does everything.

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

Sidebar

Related Questions

I keep having this problem when trying to run inside directory that has server
It was working before but for an unknown reason, I keep having nullpointer exception
I'm having this problem where I keep getting this error in my console: *
I keep getting this error with HG (Mercurial), it seems like it's having a
We keep having some customers getting a warning from AVG Antivirus about our application.
I'm writing a C program but I keep having problems with my array of
I keep getting a Run Time error that says I am having an Exception
So I keep having this small problem where I have something like func ::
I am on my transitional trip from MATLAB to scipy(+numpy)+matplotlib. I keep having issues
I've been doing web development for a few months now and keep having this

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.