document.write on a page redirection

J

John

I have several domains johntexas.com, jonstexas.com, etc. that I redirect to
johnstexas.com. I got some code to pop me out of frames when this happens:


<script language = javascript type = "text/javascript">
<!-- hide from older browsers

if (top.location != self.location) {
top.location = self.location;
}

// end script hiding -->
</script>

and I modified it to put a message there when this happens:


<script language = javascript type = "text/javascript">
<!-- hide from older browsers

if (top.location != self.location) {
document.write('You have entered johntexas.com, jonstexas.com, jontexas.com
or johnseeliger.name and been redirected to johnstexas.com. This is not an
error.');
top.location = self.location;
}

// end script hiding -->
</script>

but it does not work. Am I doing it wrong?

Thanks,
-John
 
M

Mick White

John said:
I have several domains johntexas.com, jonstexas.com, etc. that I redirect to
johnstexas.com. I got some code to pop me out of frames when this happens:


<script language = javascript type = "text/javascript">
<!-- hide from older browsers

if (top.location != self.location) {
top.location = self.location;
}

// end script hiding -->
</script>

if (top.location != self.location) {
top.location = "error.html";
}

In "error,html", place a meta refresh to redirect to the url of the
original URL.
Mick
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top