By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,500 Members | 1,250 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,500 IT Pros & Developers. It's quick & easy.

how to replace a URL in the address bar

P: n/a
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?...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
Jul 20 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Mark Kamoski wrote:
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?...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_Engi...049/index.html
and
http://evolt.org/article/Search_Engi...171/index.html
might be of use (although you would have to adapt them to ASP)
--
David Dorward http://dorward.me.uk/
Jul 20 '05 #2

P: n/a
mk******@yahoo.com (Mark Kamoski) writes:
....and when I browse to another section, the URL may look like this...

http://www.MySite.com/Data/Page.htm?...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
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #3

P: n/a

"Mark Kamoski" <mk******@yahoo.com> wrote in message
news:45**************************@posting.google.c om...
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?...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?...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.
Jul 20 '05 #4

P: n/a
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

"Randell D." <yo**************************@yahoo.com> wrote in message news:<xbGeb.838$6C4.499@pd7tw1no>...
"Mark Kamoski" <mk******@yahoo.com> wrote in message
news:45**************************@posting.google.c om...
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?...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?...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.

Jul 20 '05 #5

P: n/a
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.

Jul 20 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.