Link to home
Start Free TrialLog in
Avatar of Sohel Rana
Sohel RanaFlag for Australia

asked on

How to fix the url?

Hello:

I have one redirect cgi script which redirect to the another url immediately. And the url shows in the address in the explorer, it doesnt change. Here is the Script:

---------------------------------------------------
#!/usr/bin/perl

$domain = $ENV{'HTTP_HOST'};

#################################################################
# Look for domain name and convert to real location
# PLEASE CHANGE domain names and locations to your own

if (($domain eq 'www.domain1.com') || ($domain eq 'domain1.com')) {
  &Redirect("http://www.domain2.com/index.html",
          "Asian Classified.COM",
          "Best Classifieds Service",
          "classifieds,asia,asian,ad,business,free,travel",
          "Author",
          "Domain2.com",
          "Copyright (c) 1999-2001 Domain2.com"  )
}



 
#################################################################
# Redirect to real location. Real URL will hidden
# Function parameters:
#   0. Real URL location  - required
#   1. Site Title         - required
#   2. Site Description
#   3. Site Keywords
#   4. Site Author
#   5. Site Owner
#   6. Site Copyright

sub Redirect { #
 print "Content-type: text/html\n\n";

 print "<html><head>\n";
 print "<meta name=\"Description\" content=\"$_[2]\">\n";
 print "<meta name=\"KeyWords\" content=\"$_[3]\">\n";
 print "<meta name=\"Author\" content=\"$_[4]\">\n";
 print "<meta name=\"Owner\" content=\"$_[5]\">\n";
 print "<meta name=\"Object\" content=\"Free\">\n";
 print "<meta name=\"Robots\" content=\"ALL\">\n";
 print "<meta name=\"Copyright\" content=\"$_[6]\">\n";
 print "<title>$_[1]</title>\n";
 print "</head>\n";

 print "<frameset frameborder=0 framespacing=0 border=0 rows=\"100%,*\" noresize>\n";
 print "<frame name=\"frame\" src=\"$_[0]\" noresize>\n";
 print "</frameset>\n";
 print "<meta http-equiv=refresh content=\"0; url=$_[0]\">\n";
 print "<a href=\"$_[0]\">$_[0]</a></html>\n";
 exit;
}

------------------------------------------------------

Now I want the same funtion in javascript. Is there any way to make the frame which uses in the above scripts that the url people open it doesn't change when it already redirect to the another url address?

Thanks

Rana
Avatar of mgaurav
mgaurav

You can make frames using JavaScript only if you create the whole page with JS, like with window.open(...) fn.
 Try this:

newWin = window.open("","","<params>");
newWin.document.writeln("<html>...");
newWin.document.writeln("<frameset...");
...
..
.

Hope it helps.
I think you'll have to use frames in order not to show the real URL
ASKER CERTIFIED SOLUTION
Avatar of CJ_S
CJ_S
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial