问题
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:
- Take the current page: http://www.example.com/pages/
- and change it to: https://admin.example.com/pages/
- then load that new URL.
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.
回答1:
Just change window.location
, e.g.
window.location=window.location.toString().replace(/^http:\/\/www\./,'https://admin.')
回答2:
javascript:location=location.href.replace(/http:/g,"https:")
来源:https://stackoverflow.com/questions/2689553/bookmarklet-to-edit-current-url