Hide actual url in address-bar using iframe

Do you want to hide the actual URL in the address-bar? Do you want to display the same url throughout the website? Then here is the tips for you do the same in your website. Just display the same URL i.e http://www.your-site.com throughout your website in address bar, no matter if you in the page http://www.your-site.com/aboutus.html.

Live Demo

As you can see demo, it displays the same url throughout the browser’s address bar.But you are navigating to different page like aboutus.html or services.html. Ok, too much explanation, now let’s know how to do it.

1) First of create, all the other relavant page like “services.html” or “contactus.html” as usual.
2) For home page, rename the actual index page like “index.html” or “index.php” as “home.html” or “home.php” or whatever name you’re comfortable with.
3)Now, in the index page like “index.html” or “index.php”, put the following code

<iframe src="home.html" width="100%" height="100%" frameborder="0" scrolling="no" />

As, you can see above, we’ve used iframe to display the “home.html” page in the home page by using “src” attribute. The width and height should be “100%” and border should be ” ” for hiding the actual URL from the browser and displaying it so normal.

When a new link is clicked in the page, it gets loaded within “iframe” and displays the same URL throughout the website.

Download Full Source Code

15 thoughts on “Hide actual url in address-bar using iframe

  1. P4trykx

    There is also somtehtigs like mode-rewrite to apache that can do similiar thing.
    But is there any reason in doing so ? For me it’s like making white text over yellow background.

  2. Well P4trykx, I respect your thought but I got around 10 emails through my contact form asking this technique to display domain name in url always. Furthermore, you are not suggested to use this technique from the SEO point of view.

    BTW I don’t think mod_rewrite can do the same thing i.e. display same url throughout the site. If you think mod_rewrite can do this then show me a example otherwise it’s very hard to believe me this…

  3. I have a website ( as you can see) and if you look at the page you can see a logi script. (which is being upgraded to a more secure one soon). When you enter the correct details you are directed to another page. That is why i need a way to hide the contents of the address bar, security. Is there any other way of doing this than frameset?
    Thankyou, Daniel Curzon

  4. For that you can post the values or you can put these values in session to hide the content in the address bar..

  5. this is a good trick to hide the url.


  6. richiebee

    can’t see the code above the following code

  7. ned

    The code hides the URL when you click on the link, but not when you put the mouse on the link. Give it a try and put the mouse on one of the link and you will see the URL changing on status bar.

  8. ya true…..you can see the actual URL in the status bar ….for that you can look at this post…


  9. James Young

    Suppose i have a link http://www.website1.com/xyz , if user clicks on this link i want to display in address bar as http://www.website2.com/xyz .. Is it possible ?

    Thanks for the help !

  10. Arun Rathod

    Guys, I need your help. I have some people working on a website. Now I dont want the to know the URL of that website in the address bar, and also dont want them to navigate to any other page. So I dont have any solution for that.
    What i think is to keep that webpage on the homepage of the web browser and than delete the navigation tool bar completely. Can I do that? Or do you have anyother solution for my problem. Please replay soon.

  11. hi, this is best trick… thanks for that…

  12. Bharat Patel

    Hey this is exactly what i was looking for.

    I had been facing this problem but unable to find the way out.

    Thanks a lot for that.

  13. mac

    Perfect…. exactaly what i needed. Thanks!

  14. sandeep pathak

    thanks u alot…………………………..

  15. Hi Perfect for my web site client area preview section. Clients are able to test there sites before going live. The only problem I have is that the 100% height will not work so I have had to put a large pixel figure in, apart from that it’s just what I was looking for. never gave iframe a second thought.

    Thanks good work………..

Leave a Reply

Your email address will not be published. Required fields are marked *