how to replace a URL in the address bar

M

Mark Kamoski

Hi--

How can one replace the URL in the address bar to a "friendly alternative"?

Is there a way to do this with JavaScript?

Is there a way to do this ASP.NET?


For example, suppose I have a site that has the URL...

http://www.MySite.com/

....and when I browse to one section in this site, the URL may look like
this...

http://www.MySite.com/Products/

.....and when I browse to another section, the URL may look like this...

http://www.MySite.com/Data/Page.htm?Value=17&Description=52

....and so on, with many different ugly URL strings....

....now, what I want to do is to make the URL in the browser's window always
look like this...

http://www.MySite.com

....no matter what page I am on in the site.


What do you think?

Is there a way to do this with JavaScript?

Is there a way to do this ASP.NET?

Please advise.

Thank you very much.

--Mark
 
D

David Dorward

Mark said:
How can one replace the URL in the address bar to a "friendly
alternative"?

The addressbar can not display anything other then a real URI that
references the page currently being viewed in the top frame.
Is there a way to do this with JavaScript?

No

For example, suppose [...] I browse to one section in this site, the URL may
look like this...
http://www.MySite.com/Data/Page.htm?Value=17&Description=52

...and so on, with many different ugly URL strings....

Use some form of address rewriting (or just clever scripting) so that you
have it in the form:

http://www.MySite.com/Data/17/52/

.... having your content management system spit out more useful ways to
reference the data would be a good idea.
...now, what I want to do is to make the URL in the browser's window
always look like this...
http://www.MySite.com

...no matter what page I am on in the site.
What do you think?

I think its a good way to screw up the ability of visitors to bookmark
pages, but possible with frames (although search engines will bypass them
as usual).

http://evolt.org/article/Search_Engine_Friendly_URLs_with_PHP_and_Apache/17/15049/index.html
and
http://evolt.org/article/Search_Engine_Friendly_URLs_Part_II/17/17171/index.html
might be of use (although you would have to adapt them to ASP)
 
L

Lasse Reichstein Nielsen

....and when I browse to another section, the URL may look like this...

http://www.MySite.com/Data/Page.htm?Value=17&Description=52
...now, what I want to do is to make the URL in the browser's window always
look like this...

http://www.MySite.com

The typical method is to let the front page of www.mysite.com be a
frameset with only one frame. Then all navigation happens inside the frames,
and the top URL doesn't change.

But don't think for a second that you are doing it for the users. You
are doing it because *you* want a cleaner look on your page. The users
either don't care, or care and don't like people munging their address
line.

/L
 
R

Randell D.

Mark Kamoski said:
Hi--

How can one replace the URL in the address bar to a "friendly alternative"?

Is there a way to do this with JavaScript?

Is there a way to do this ASP.NET?


For example, suppose I have a site that has the URL...

http://www.MySite.com/

...and when I browse to one section in this site, the URL may look like
this...

http://www.MySite.com/Products/

....and when I browse to another section, the URL may look like this...

http://www.MySite.com/Data/Page.htm?Value=17&Description=52

...and so on, with many different ugly URL strings....

...now, what I want to do is to make the URL in the browser's window always
look like this...

http://www.MySite.com

...no matter what page I am on in the site.


What do you think?

Is there a way to do this with JavaScript?

Is there a way to do this ASP.NET?

Please advise.

Thank you very much.

--Mark

Use FRAMES - I think there is a NOFRAME tag that you can use for search
engines and web crawlers - Mind you, some search engines don't entirely
follow non-html linked pages (thus

http://www.MySite.com/Data/Page.htm?Value=17&Description=52

may not be followed by some crawlers meaning there will be little loss using
frames...

JavaScript cannot change the address bar - its not a failure, its a security
feature.
 
M

Mark Kamoski

Randell--

Thank you for your reply.

As I understand it, if one uses frames as noted above, then it is
possible to change the URL.

Do you (or does anyone) have any sample code for doing this with
frames?

Please advise.

Thank you.

--Mark
 
L

Lee

Mark Kamoski said:
Randell--

Thank you for your reply.

As I understand it, if one uses frames as noted above, then it is
possible to change the URL.

No, that's not quite correct.
You cannot change the URL, period.
If you use frames, the displayed URL will be that of the frameset
page. You can then load other pages in a frame, and the displayed
URL will still be that of the frameset.
No JavaScript is required to do this. It's basic HTML.
Note, however, that not all browsers support frames.
 

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,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top