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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T02:25:14+00:00 2026-05-14T02:25:14+00:00

How does the Same Origin Policy apply to the following two domains? http://server1.MyDomain.com http://server2.MyDomain.com

  • 0

How does the Same Origin Policy apply to the following two domains?

http://server1.MyDomain.com

http://server2.MyDomain.com

Can I run JS on a page hosted on server1, if the content is retreived from server2?

edit according to Daniel’s answer below, I can include scripts between different subdomains using the <script> tag, but what about asynchronous requests? What if I download a script from server2 onto the page hosted on server1. Can I use the script to communicate asynchronously with a service on server2?

  • 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-14T02:25:15+00:00Added an answer on May 14, 2026 at 2:25 am

    You can only include scripts between different subdomains using the <script> tag, as it is exempt from the policy.

    Using http://www.example.com/dir/page.html as source (from Wikipedia):

    Compared URL                               Outcome  Reason
    ---------------------------------------------------------------------------------------------
    http://www.example.com/dir/page.html       Success  Same protocol and host
    http://www.example.com/dir2/other.html     Success  Same protocol and host
    http://www.example.com:81/dir2/other.html  Failure  Same protocol and host but different port
    https://www.example.com/dir2/other.html    Failure  Different protocol
    http://en.example.com/dir2/other.html      Failure  Different host
    http://example.com/dir2/other.html         Failure  Different host (exact match required)
    http://v2.www.example.com/dir2/other.html  Failure  Different host (exact match required)
    

    UPDATE:

    Can I use the script to communicate
    asynchronously with a service on
    server2?

    Yes, you can with JSONP, which takes advantage of the open policy for <script> tags to retrieve JSON from other origins.

    You may also want to consider using a reverse proxy, as desribed in the following Stack Overflow post:

    • What am I missing in the XMLHttpRequest?
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically I'm trying to accomplish the same thing that mailto:bgates@microsoft.com does in Internet Explorer
I'm looking for an app that does about the same thing at the Performance
This question is related to (but perhaps not quite the same as): Does Django
Does String.ToLower() return the same reference (e.g. without allocating any new memory) if all
Does TCP/IP prevent multiple copies of the same packet from reaching the destination? Or
Does ADOdb do data sanitation or escaping within the same functionality by default? Or
Does MS Access 2007 support internal foreign keys within the same table?
Does anyone know of a script to colorize C++ code the same as the
Does anyone know what is the behavior for C#? Is it the same for
Does using Multiple .NET Languages (Delphi, VB.NET, C#) into the same application (but in

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.