Solved

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

Posted on 2011-02-23
5
678 Views
Last Modified: 2012-05-11
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
Comment
Question by:rgbcof
5 Comments
 
LVL 82

Expert Comment

by:leakim971
Comment Utility
do you have the control of the index page ?
0
 
LVL 4

Accepted Solution

by:
LAMASE earned 250 total points
Comment Utility
You can empty the current dom and insert an iframe with src="theotherpage".
Why do you need to hide an url?
0
 
LVL 82

Expert Comment

by:leakim971
Comment Utility
This is you index.php :


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

Open in new window

0
 
LVL 12

Expert Comment

by:Amick
Comment Utility
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
 

Author Closing Comment

by:rgbcof
Comment Utility
It turns out the an iframe is the best solution.  The url never divulge any path below  it.
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now