Modify url in browser using javascript?
        Posted  
        
            by user246114
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by user246114
        
        
        
        Published on 2010-06-16T15:26:18Z
        Indexed on 
            2010/06/16
            15:32 UTC
        
        
        Read the original article
        Hit count: 202
        
JavaScript
Hi,
Is it possible to change the url in the user's browser without actually loading a page, using javascript? I don't think it is (could lead to unwanted behavior), I'm in a situation where this would be convenient though:
I have a web app which displays reports generated by users. Layout roughly looks like:
-----------------------------------------------------------
 Column 1    |   Column 2
-----------------------------------------------------------
  Report A   |
  Report B   |  Currently selected report contents here.
  Report C   |
right now the user would be looking at a url like:
www.mysite.com/user123
To see the above page. When the user clicks the report names in column 1, I load the contents of that report in column 2 using ajax. This is convenient for the user, but the url in their browser remains unchanged.
The users want to copy the url for a report to share with friends, so I suppose I could provide a button to generate a url for them, but it would just be more convenient for them to have it already as the url in their browser, something like:
www.mysite.com/user123/reportb
the alternate is to not load the contents of the report in column 2 using ajax, but rather a full page refresh. This would at least have a linkable url ready for the user in their url bar, but not as convenient as using ajax.
Thanks
© Stack Overflow or respective owner