Solved

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

Posted on 2011-02-23
3
319 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
Comment Utility
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
Comment Utility
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
Comment Utility
It turns out the an iframe is the best solution.  The url never divulge any path below  it.
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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…

772 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