Redirection if referrer is invalid

D

djpnuemo

i am creating a site that i want to restrict viewing of an .html view
if the referrer isn't from my domain. i've scoured the interwebs and
found plenty of code, but none completely work. there is an example
below that does work, except for IE6. if someone could help me out to
make this work properly with IE6, i would sure appreciate it..

<SCRIPT LANGUAGE="JavaScript" >
<!-- Begin
var requiredfrom = "http://mysite.com/"; // required prev. page
if (document.referrer.indexOf(requiredfrom) == -1) {
alert("You must logon first...");
window.location='http://mysite.com/';
}
// End -->
</script>
 
D

djpnuemo

also, if there is another language, like php or perl, that may do this
and support IE6, i'd be open to that as well.
 
D

djpnuemo

i don't have time to search the 16 million or so pages for something
that has no relevance to my question.

no, this is not being tested offline. i've tried so many combinations,
it's starting to make me angry. any suggestions you have, would be
greatly appreciated.
 
D

djpnuemo

probably worth noting...

the page that this code is placed in, the page is displayed inside an
iframe of another page.

example:

INDEX.HTML
-<iframe src="text.html"></iframe>

TEXT.HTML
-(PREVIOUSLY POSTED CODE)

i've tried different domain referrers
 
D

djpnuemo

quote

"<shudder>

You can search the archives for the 16 million or so times that it has
been explained that you can drop the archaic comments and not to use
the
language attribute (which is deprecate). "

i never asked about if comments are archaic or necessary. hence the
reason i don't need to search for it. i DID search the archives for my
particular problem. no results helped which is why i posted. i posted
a snippet of code which had a comment in it. you are irritated that i
didn't search and find out that YOU can't stand when people post this
extraneous information.

now, you didn't give me ANY help at all. "Are you testing that off
line perhaps?" that's a question for an idiot that doesn't know how to
properly test.

the post about how this group is extremely negative, is true. just
because you have advanced knowledge of something, doesn't give you the
right to diminish or chastise someone for knowing EVERYTHING you do.

i've figured out the problem on my own and therefore don't need to
subject myself to your condescending attitude any more.
 
D

Dr J R Stockton

In comp.lang.javascript message <[email protected]>,
You post things, we discuss it.

Rather than wittering on at innocent newcomers, why do you not do
something useful, such as either fulfilling or resigning your obligation
to maintain the newsgroup FAQ? In spite of many suggestions, some good,
there has been no new release since - 9.70 - 2007-03-22.

Then we could discuss it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,143
Latest member
SterlingLa
Top