Šim*_*das 4 javascript console google-chrome-devtools firefox-developer-tools
我有这个JavaScript文件的URL:
https://rawgit.com/Khan/tota11y/master/build/tota11y.min.js
(托管在GitHub上并通过RawGit传递),我想通过浏览器控制台将其注入实时网页.
为了实现这一点,我可以动态创建一个<script>
元素并将其附加到DOM:
(function () {
var s = document.createElement('script');
s.src = 'https://rawgit.com/Khan/tota11y/master/build/tota11y.min.js';
document.body.appendChild(s);
}())
Run Code Online (Sandbox Code Playgroud)
但这既不快也不容易.我想使用一个API,通过一个简单的调用使这成为可能,例如:
exec('https://rawgit.com/Khan/tota11y/master/build/tota11y.min.js')
Run Code Online (Sandbox Code Playgroud)
Chrome或Firefox是否在其控制台中提供此类API(或类似内容)?
使用案例:在实时网页上快速测试GitHub上托管的JavaScript库.
更新:截至2018年5月18日,开发人员工具栏已从Firefox Nightly中删除.
在Firefox中,您可以使用开发人员工具栏注入脚本.把它带上Shift+F2
并打字inject https://rawgit.com/Khan/tota11y/master/build/tota11y.min.js
归档时间: |
|
查看次数: |
791 次 |
最近记录: |