JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old June 16th, 2007, 08:38 AM
mapg mapg is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Posts: 6 mapg User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 37 m 11 sec
Reputation Power: 0
Question Modify browser URL without refresh page

Hi All,

I would like to ask if it is possible to modify some part of the browser URL without refresh page in the OnClick event over a form or link inserted in the HTML code.

Currently I use ...
Code:
if (blah == blah) {
      window.location.href = window.location.href.replace(/\&ni\=on/ig, '');
}
But this force to refreshing.

I want to remove "&ni=on" without refresh page as I mentioned.

Is it possible? Any idea is welcome.

Thank you in advance.

Mapg

Reply With Quote
  #2  
Old June 16th, 2007, 03:16 PM
Mittineague's Avatar
Mittineague Mittineague is offline
Contributing User
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jul 2005
Location: West Springfield, Massachusetts
Posts: 552 Mittineague User rank is Private First Class (20 - 50 Reputation Level)Mittineague User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Week 1 Day 9 h 1 m 33 sec
Reputation Power: 10
page reload w/o reload

If you want the page to reload to a different URL without reloading, maybe you're looking for AJAX?
Or, if you don't want the GET vars in the URL maybe try POST vars instead.

Reply With Quote
  #3  
Old June 16th, 2007, 05:13 PM
mapg mapg is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Posts: 6 mapg User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 37 m 11 sec
Reputation Power: 0
Thank you. I will try with Ajax then.

Mapg

Reply With Quote
  #4  
Old June 19th, 2007, 11:25 PM
ravs ravs is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2006
Location: gurgaon, haryana, india
Posts: 60 ravs User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 44 m 29 sec
Reputation Power: 9
Send a message via Yahoo to ravs
hey pal,
do u only want to change the page url, nothing else...
then it is a waste of time....

Reply With Quote
  #5  
Old June 21st, 2007, 08:49 AM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,886 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 19 m 35 sec
Reputation Power: 14
Quote:
Originally Posted by ravs
hey pal,
do u only want to change the page url, nothing else...
then it is a waste of time....


I'll tend to agree with this. I find it a little unclear as to what your ultimate goal is.
Do you just want the URL in the address bar to look different? Or are you trying to redirect the user?
__________________
Daryl's Homepage | My Blogroll | My Profile | Firefox supporter!
DevArticles Forum Moderator

"The net is a waste of time, and that's exactly what's right about it." -- William Gibson

Reply With Quote
  #6  
Old June 27th, 2007, 02:12 PM
jwriteclub jwriteclub is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2007
Posts: 1 jwriteclub User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 m 21 sec
Reputation Power: 0
Use for URL change without reload

This would be an incredibly useful thing to be able to do and I am currently looking for just such a solution.

Suppose you have a complex AJAX application. The user starts at a page (myserver.com/app/). A php file with include(app.php) this is really loading /app/app.php, which is the main application file.

Now, the user clicks around and has the application in a state which they would like to be able to bookmark.

IF one could update the URL (for example /app/foo/bar/) then a simple mod_rewrite would allow you to access app.php?info1=foo&info2=bar.

Ideally, one would also be able to push these URL changes onto the history stack as well, but I can handle history internally, if I have a method of reaching an unchanging deep bookmark.

A further note on this is that it does make sense to update the URL, because the page is changing, but via an XMLHttpRequest instead of a full refresh

Reply With Quote
  #7  
Old August 24th, 2007, 10:37 AM
dkrape dkrape is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2007
Posts: 1 dkrape User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 m 34 sec
Reputation Power: 0
Actually, this is quite easy (as I was happy to just find out).

Simply:

Code:
parent.location.hash = "hello";
I found this solution here: thescripts.com/forum/thread170365.html

Reply With Quote
  #8  
Old February 3rd, 2010, 09:04 AM
Alan-A Alan-A is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2010
Posts: 2 Alan-A User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 23 m 11 sec
Reputation Power: 0
Quote:
Originally Posted by dkrape
Actually, this is quite easy (as I was happy to just find out).


Whilst it appears that you can modify the location.hash parameter without the page reloading (tested only FF2.0.0.20) setting the hash to "" will cause a reload and " " causes FF to show "#%20".

Alan

Reply With Quote
  #9  
Old February 3rd, 2010, 11:04 AM
Alan-A Alan-A is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2010
Posts: 2 Alan-A User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 23 m 11 sec
Reputation Power: 0
Quote:
Originally Posted by Alan-A
... and " " causes FF to show "#%20".

What I didn't say is that modifying href to " " causes a partial reload of FF - the window appears to be refreshed but neither my JavaScript nor the dynamically added content get lost.
Tested in FF 2.0.0.20 & 3.0.17.

Alan

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJavaScript Development > Modify browser URL without refresh page


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.

© 2003-2014 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap