从bookmarklet加载外部JS? [英] Load external JS from bookmarklet?

查看:150
本文介绍了从bookmarklet加载外部JS?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用书签加载外部JavaScript文件?这将克服IE的URL长度限制,并通常保持清洁。

How can I load an external JavaScript file using a bookmarklet? This would overcome the URL length limitations of IE and generally keep things cleaner.

推荐答案

2015年更新



内容安全政策将阻止它现在在许多网站上工作。例如,以下代码无法在Facebook上运行。

2015 Update

Content security policy will prevent this from working in many sites now. For example, the code below won't work on Facebook.

使用创建的书签包含外部JS的脚本标记。

Use a bookmarklet that creates a script tag which includes your external JS.

作为示例:

javascript:(function(){document.body.appendChild(document.createElement('script')).src='** your external file URL here **';})();

这篇关于从bookmarklet加载外部JS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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