How to suppress the URL shown in the address bar?

Brian Glodde

Try using a hidden frame, similar to this:

<frameset rows="0,*" framespacing="0" frameborder="0" border="0">
    <frame name="hiddenfrm" src="blank.jsp" scrolling="no" noresize>
    <frame name="content" src="home.jsp" noresize>

Then all querystrings will be hidden, the address bar will display only where the default document is located.

[However, Michael Dean warns:]

And the user cannot bookmark any pages. And the browser's history list will contain a bunch of identical names (meaning it's extremely difficult to find a specific page from the list under the Back button--browse a few pages in the frames version of the API javadoc to see). And a user opening a link in a new window (i.e. right-click, "Open Link in New Window") or bookmarking a link (i.e. right-click, "Bookmark This Link") will get only part of the page--possibly losing a navigation bar or a title frame (or, if all content is in the "content" frame, will see the page and its location in the location bar--thereby getting around your desired behavior). And when a new window is opened or a link accessed directly via a bookmark, the user may get strange behavior due to target attributes of the a (anchor) element. And ...

But if you really want to create a difficult to use web application (or, more likely, your boss is telling you to do so), go ahead--you won't be the only one. :)

Remember, the reason that the web is so popular is because the user controls the experience. Therefore, any time you ask, "How do I remove some capability provided by HTTP and/or HTML?" Abraham Lincoln answered the question best, "You can fool some of the people all of the time, and all of the people some of the time, but you can not fool all of the people all of the time."

Being able to display one address in the location bar while displaying a page from another "anonymous" location without any way for the user to identify the "misdirection" would be a huge security problem. HTTP/HTML make the location available to the user so he/she can potentially make informed decisions about whether to submit information.

[See also:

- Alex]