Javascript append to URL
Page 1 of 1
sabin1981
Mostly Cursed



Posts: 87805

PostPosted: Thu, 25th Dec 2014 18:33    Post subject: Javascript append to URL
Hi guys, I've currently got this great and thoroughly useful Javascript entry that's saved as a bookmark on my FF toolbar, I click it and it translates the page direct from Microsoft so clicking the bookmark translates the page without hassle.

Code:
javascript:(function(){var%20s%20=%20document.createElement('script');%20s.type%20=%20'text/javascript';%20s.src%20=%20'http://labs.microsofttranslator.com/bookmarklet/default.aspx?f=js&to=en';%20document.body.insertBefore(s,%20document.body.firstChild);})()


Is there anything similar to append an item/entry/"thing" to the end of a URL in the current address bar and then reload the page? I want to add "/?cc=gb" to the end of any page I click for Steam Store, since the damned thing keeps switching back to NO because of geofiltered crap. Thanks guys, much appreciated Smile
Back to top
Werelds
Special Little Man



Posts: 15098
Location: 0100111001001100
PostPosted: Thu, 25th Dec 2014 23:22    Post subject:
Code:
javascript:(function(){var a=window.location.href;if(a.match(/cc=\w+/gi)){a=a.replace(/cc=\w+/gi,'cc=gb')}else{a=a+((a.indexOf('?')>=0)?'&cc=gb':'?cc=gb')}}());


That should do the trick (completely untested Razz).
Back to top
sabin1981
Mostly Cursed



Posts: 87805

PostPosted: Thu, 25th Dec 2014 23:38    Post subject:
No, sorry bud.. nothing happens when I click the bookmark "link", no changes to URL, no reload, nadda. Thanks though!
Back to top
Werelds
Special Little Man



Posts: 15098
Location: 0100111001001100
PostPosted: Fri, 26th Dec 2014 23:13    Post subject:
Sorry, forgot to add the last bit to actually change the damn thing.

Code:
javascript:(function(){var a=window.location.href;if(a.match(/cc=\w+/gi)){a=a.replace(/cc=\w+/gi,'cc=gb')}else{a=a+((a.indexOf('?')>=0)?'&cc=gb':'?cc=gb')}window.location.href=a}());
Back to top
sabin1981
Mostly Cursed



Posts: 87805

PostPosted: Fri, 26th Dec 2014 23:16    Post subject:
You rock!! Nice one Paul, thank you very much, you just saved me a lot of hassle. I don't know why Valve/Steam won't just STORE information >_<
Back to top
Page 1 of 1 All times are GMT + 1 Hour
NFOHump.com Forum Index - Applications
Signature/Avatar nuking: none (can be changed in your profile)  


Display posts from previous:   

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB 2.0.8 © 2001, 2002 phpBB Group