0

I am using $.getscript(""); to get remote script. However, when I use it, the referer information goes to there. I don't want to send the referer information when I use the function. Tried this without any luck,

$.ajaxSetup({
    headers: { "Referer": "" }
});

$.getScript("http://www.example.org/script.js");

What is the correct way to do that ?

2 Answers 2

1

The browser will overwrite the referrer always for the tests that I've done. Meaning you can't change the referrer of an ajax call.

Since getscript() is documented as being shorthand for an ajax call, this also applied to getscript().

See:

changing the referrer of an Ajax POST

http://api.jquery.com/jquery.getscript/

Sign up to request clarification or add additional context in comments.

Comments

1

If you're sending a request from a non-secure source to a secure source (http to https) the browser should not send the referer with the request. That is only a workaround though and it depends how well the browser follows through with web standards.

4 Comments

Its from http to http
If the source of the javascript file supports SSL/TLS (https) then try using that instead. The referer header should not be sent.
So you mean If I run the getscript function on a https site to http site, it wont send referer, correct ?
@user198989 actually i'm mistaken, sorry about that. The request had to be sent from https to http not the other way around. Sorry about that. You've got it right though, so yes that's correct.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.