FAQ Topic - How do I change the text in the url/location bar?

F

FAQ server

-----------------------------------------------------------------------
FAQ Topic - How do I change the text in the url/location bar?
-----------------------------------------------------------------------

This text can only be altered by changing the URL of the page.
The normal solution is to use frames, though this can introduce
problems of its own.


===
Postings such as this are automatically sent once a day. Their
goal is to answer repeated questions, and to offer the content to
the community for continuous evaluation/improvement. The complete
comp.lang.javascript FAQ is at http://www.jibbering.com/faq/.
The FAQ workers are a group of volunteers.
 
R

Randy Webb

FAQ server said the following on 1/7/2007 7:00 PM:
-----------------------------------------------------------------------
FAQ Topic - How do I change the text in the url/location bar?
-----------------------------------------------------------------------

This text can only be altered by changing the URL of the page.
The normal solution is to use frames, though this can introduce
problems of its own.

The second statement doesn't even come close to answering the question.
It is almost totally irrelevant to the question asked. Frames are the
"normal solution" *not* to change the text in the url/location bar.
Although there are other "solutions" now, IFrame/AJAX/Loading JS
Files/etc...
 
R

Richard Cornford

Randy said:
FAQ server said the following on 1/7/2007 7:00 PM:

The second statement doesn't even come close to answering the
question. It is almost totally irrelevant to the question asked.
Frames are the "normal solution" *not* to change the text in the
url/location bar. Although there are other "solutions" now,
IFrame/AJAX/Loading JS Files/etc...

Frames (which include IFRAME elements) can be used to control the URL
shown in the location bar. If you want to show contents at one location
and the URL of another then (navigating to) a page at the URL that is to
go into the location bar that has a frame pointing the URL of the
desired content achieves that.

Richard.
 
R

Randy Webb

Richard Cornford said the following on 1/7/2007 8:15 PM:
Frames (which include IFRAME elements) can be used to control the URL
shown in the location bar.

In the sense it hides/masks the URL then it controls it.
If you want to show contents at one location and the URL of another
then (navigating to) a page at the URL that is to go into the location
bar that has a frame pointing the URL of the desired content achieves that.

That is very true but doesn't answer the question that is asked. While
it "controls" the URL, it doesn't actually change it, it merely
hides/masks the true URL. And there are other methods to achieve that
that are not mentioned. AJAX being one of them.

The question it does answer is "How do I mask/hide the true URL of the
page?"

And, if the FAQ Entry is designed to answer how to hide/mask the URL
then shouldn't the question be changed?
 
R

Roy A.

FAQ server skrev:
-----------------------------------------------------------------------
FAQ Topic - How do I change the text in the url/location bar?
-----------------------------------------------------------------------

This text can only be altered by changing the URL of the page.
The normal solution is to use frames, though this can introduce
problems of its own.

I don't think you can do that without a round-trip to the server. The
normal solution is to use url rewrite or custom error pages. With
frames, the frameset page would have to be a real url with a frameset
document.

With custom error pages you could use JavaScript to submit a form with
a real location to a non existing url on the domain. Then, on the
server, you could use JavaScript to include the real page.
 
R

Randy Webb

Roy A. said the following on 1/8/2007 7:49 AM:
FAQ server skrev:

I don't think you can do that without a round-trip to the server.

Actually, you can. An anchor within a page will change the text in the
url/location bar but it won't make a round-trip to the server. The FAQ
itself uses anchors :)
The normal solution is to use url rewrite or custom error pages. With
frames, the frameset page would have to be a real url with a frameset
document.

That is not entirely true. If the custom error page uses url rewrite to
point to the true frameset page...
With custom error pages you could use JavaScript to submit a form with
a real location to a non existing url on the domain. Then, on the
server, you could use JavaScript to include the real page.

I think (and not totally positive) that what got that question into the
FAQ to begin with was people asking how to hide the true URL of the
page. With the advent and popularity of the XMLHttpRequest Object you
don't see that question asked very often anymore.

In either event, the question has become mostly moot but the answer in
the FAQ doesn't begin to cover the possibilities of leaving the URL
intact while changing the page.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,902
Latest member
Elena68X5

Latest Threads

Top