Solved

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

Posted on 2011-02-23
3
320 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
  • 2
3 Comments
 
LVL 16

Accepted Solution

by:
sjklein42 earned 250 total points
ID: 34966203
You could hide it in an IFRAME, like this.  It may take some tuning to get the scrollbars right.
<html><body leftmargin=0 topmargin=0><iframe src="http://www.myotherdomain.com/myotherpage.html" width=100% height=100% frameborder=0 scrolling=auto></iframe></body></html>

Open in new window

0
 
LVL 16

Expert Comment

by:sjklein42
ID: 34966468
Create this file, call it ".htaccess" with the leading dot.

Edit to substitute your pages for "visible.html" and "hidden.html".

Put it in your web site folder

When the user goes to visible.html, they actually see the contents of "hidden.html" but the address field still says "visible.html".

Options +FollowSymLinks
 
RewriteEngine On
RewriteBase /

RewriteRule ^visible.html$ hidden.html

Open in new window

0
 

Author Closing Comment

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

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
This article discusses how to create an extensible mechanism for linked drop downs.
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…

939 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

10 Experts available now in Live!

Get 1:1 Help Now