• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

to disable auto redirect

 
Ranch Hand
Posts: 937
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
in my app when user types www.mysite.mypage.com it automatically redirect to www.mypage.com.
when the user types www.mysite.mypage.com i need to say the user this no longer exists and u have to type this. can anyone tell me how to do that.
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
okay now I got the email, but IO have some questions. I am posting it here in case anyone else would like to know. The sub-domain thing is usually set up by the server host.
Now is the actual subdomain 'mysite' still showing up in the address bar after it loads?
if so this is what I would do:
<script>
TheAddy="http://www.thepage.com"; //make sure it is in lower case!!
TheLoc=self.location.href.toLowerCase();
if(TheAddy!=TheLoc){self.location.href="TheErrorPage.htm";}
</script>

Now if this is not the case and the real addy shows, then I think you might be able to pull it off with document.referer
<script>
TheAddy="http://www.thepage.com"; //make sure it is in lower case!!
TheLoc=document.referer.toLowerCase();
if(TheAddy!=TheLoc){self.location.href="TheErrorPage.htm";}
</script>

Now you would just put this in the heads of your main default page. See if this does the trck, if not then we will figure out another approach!
Eric
 
sunitha reghu
Ranch Hand
Posts: 937
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sorry to say nothing didnt work
my script or ur script
this is wat i did
so i wrote like this. then wat happened is when i type www.mysite.com/itstest/ always went to error.html
im doing something wrong
TheAddy="http://www.mysubsite.mysite.com/itstest/"; //make sure it is in lower case!!
//TheLoc=self.location.href.toLowerCase();
//TheLoc=document.referer.toLowerCase();
if(self.location.href=TheAddy){self.location.href="http://www.mysite.com/itstest/html/error.html";}
 
sunitha reghu
Ranch Hand
Posts: 937
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This piece of code is working in ie and ns 4.7 but not in ns 6.0 and ns 7.0 can anytell how to fix that
<body>
<script language="JavaScript">
if (location.href.toLowerCase() == "http://www.mynotsite.mysite.com") {
location.href="http://www.mysite.com/nherror.html"
}
</script>

The code below is another one but it didnt work
donno why its not working
<script language="JavaScript">
<!--
function gotoPage()
{
var dns1 = "www.mynotsite.mysite.com"

var urlloc = location.href
var loc = urlloc.toLowerCase()

if(loc == dns1)
//alert("same location");

location.href="http://www.mynotsite.mysite.com/error.html"
}
</script>
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
okay, here is something to look at:
on the page you want redirect try using this script to figure out what is happening
<script>
A=document.referer.toLowerCase();
B=self.location.toLowerCase();
alert(A);
alert(B);
</script>
now see if the subdomain shows up in either of the alerts.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic