Go Premium for a chance to win a PS4. Enter to Win

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 330
  • 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(){

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

  • 2
1 Solution
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

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

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

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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