Bookmarklet用于编辑当前URL [英] Bookmarklet to edit current URL

查看:81
本文介绍了Bookmarklet用于编辑当前URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一个简单的书签来获取我网站的当前网址并通过一些更改来刷新它。例如:

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. 获取当前页面: http://www.example.com/pages/

  2. 并将其更改为: https://admin.example.com/pages/

  3. 然后加载该新网址。

我尝试搜索可以执行此操作的书签,但我找不到。谁能指出我正确的方向?即使是像我这样可以编辑的小书签,也可以根据我的需要进行编辑。

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.

推荐答案

只需更改 window.location ,例如

window.location=window.location.toString().replace(/^http:\/\/www\./,'https://admin.')

这篇关于Bookmarklet用于编辑当前URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆