• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 702
  • Last Modified:

javascript, how to redirect (from index.html page) but does not show url of the new page

How to redirect (from index.html page) but does not show url of the new page
For example, type in the domain (e.g. http://testwebpage.com)  this takes  me to my index page, which I want to redirect somewhere else.  However I don't want to see the new url on the browser.
My code so far:

<script language="JavaScript">
function redirectToNewPage(){
  location.href="/dir1/newpage.html";
}
</script>

</HEAD>
<BODY bgcolor="black" text=white onLoad="redirectToNewPage()">
</BODY>
</HTML>

0
rgbcof
Asked:
rgbcof
1 Solution
 
leakim971PluritechnicianCommented:
do you have the control of the index page ?
0
 
LAMASECommented:
You can empty the current dom and insert an iframe with src="theotherpage".
Why do you need to hide an url?
0
 
leakim971PluritechnicianCommented:
This is you index.php :


<?PHP
   $content = file_get_contents("/dir1/newpage.html");
   echo $content;
?>

Open in new window

0
 
AmickCommented:
No need to use JavaScript . Try
<html>
<head>

</head>
<body>
<object type="text/html" height="100%" width="100%"
data="http://www.experts-exchange.com/">
</object>
</body>
</html>

Open in new window


or
<html>
 <head>
 <title>OBJECT</title>
 <frameset cols = "100%">
 <frame src="http://www.experts-exchange.com" />
 </frameset>
 </head>
 <body>
 </body>
 </html>

Open in new window


0
 
rgbcofAuthor Commented:
It turns out the an iframe is the best solution.  The url never divulge any path below  it.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now