how to replace a URL in the address bar

Discussion in 'Javascript' started by Mark Kamoski, Oct 1, 2003.

  1. Mark Kamoski

    Mark Kamoski Guest

    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
     
    Mark Kamoski, Oct 1, 2003
    #1
    1. Advertising

  2. 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?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)


    --
    David Dorward http://dorward.me.uk/
     
    David Dorward, Oct 1, 2003
    #2
    1. Advertising

  3. (Mark Kamoski) writes:

    > ....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
    --
    Lasse Reichstein Nielsen -
    Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
    'Faith without judgement merely degrades the spirit divine.'
     
    Lasse Reichstein Nielsen, Oct 1, 2003
    #3
  4. Mark Kamoski

    Randell D. Guest

    "Mark Kamoski" <> wrote in message
    news:...
    > 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.
     
    Randell D., Oct 1, 2003
    #4
  5. Mark Kamoski

    Mark Kamoski Guest

    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." <> wrote in message news:<xbGeb.838$6C4.499@pd7tw1no>...
    > > "Mark Kamoski" <> wrote in message
    > > news:...
    > > 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.
     
    Mark Kamoski, Oct 2, 2003
    #5
  6. Mark Kamoski

    Lee Guest

    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.
     
    Lee, Oct 2, 2003
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. ben
    Replies:
    0
    Views:
    489
  2. Matt
    Replies:
    0
    Views:
    3,604
  3. John Hann
    Replies:
    0
    Views:
    6,170
    John Hann
    Aug 21, 2004
  4. Matt
    Replies:
    9
    Views:
    71,254
  5. Matt
    Replies:
    9
    Views:
    648
    kaeli
    Aug 23, 2004
Loading...

Share This Page