/    Sign up×
Community /Pin to ProfileBookmark

Can JavaScript get the Enviorment Variables?

In perl one can use this, $url= $ENV{‘HTTP_REFERER’} to obtain the url of the page that called it. Does JavaScript offer an equivalent?

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@UltimaterNov 20.2005 — document.referrer (note the extra "R" aside from Perl)

Beware however that it can be messed with. But I'm sure that you already know this by using JavaScript in the first palce. Also note that browser settings can disable the referrer from carrying any value. If there is no referrer, it contains a blank string. Also note that people can use telnet or a serverside language to alter the referer to give the referrer a string containing HTML, or even Server Side Includes. A good majority of your users will have their browser settings disabling the referrer from being used. You'd have more users with cookies enabled. Consider using cookies, sessions, or the query string instead.
Copy linkTweet thisAlerts:
@Mike_BurdickauthorNov 20.2005 — Ultimater,

Thanks!

Mike
×

Success!

Help @Mike_Burdick spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...