views:

200

answers:

3

Hi, I'm looking for a simple bookmarklet to take the current URL of my website and refresh it with a couple of changes. For example:

  1. Take the current page: http://www.example.com/pages/

  2. and change it to: https: //admin.example.com/pages/ *

  3. then load that new URL.

*(I added an extra space after https:// because I'm a new user so can't have more than one link in my question)

I tried searching for a bookmarklet that can do this but I couldn't find one. Can anyone point me in the right direction? Even a bookmarklet that does something like this that I can edit to suit my needs.

Thanks for any help.

+2  A: 

Just change window.location, e.g.

window.location=window.location.toString().replace(/^http:\/\/www\./,'https://admin.')
KennyTM
Perfect. Thanksfor the record the complete code for the bookmarklet is:`javascript:(function() {window.location=window.location.toString().replace(/^http:\/\/www\./,'https://admin.');})()`
garymc
A: 

javascript:location=location.href.replace(/http:/g,"https:")

kim3er
Mine is a straight to SSL conversion. Kenny's switches sub domain as well. Remember to use the JavaScript sudo protocol in front of the JavaScript, to create a bookmarlet.
kim3er
@kim3er Do you mean pseudo protocol?
alex
A: 

Try the bookmarklet from URLParser.com @ http://URLParser.com/bookmarklet/

URLParser.com