Bookmarklet to edit current URL

2019-02-03 16:15发布

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 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.

2条回答
我想做一个坏孩纸
2楼-- · 2019-02-03 16:36

Just change window.location, e.g.

window.location=window.location.toString().replace(/^http:\/\/www\./,'https://admin.')
查看更多
我只想做你的唯一
3楼-- · 2019-02-03 16:41

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

查看更多
登录 后发表回答