Forwarded from duangsuse Throws
duangsuse::Echo
咱检查了下互动 live2d-widget ,发现是只有 200 行的全界面逻辑,真正的实现在 https://github.com/stevenjoezhang/asteroids/blob/master/asteroids.js ,被直接插入到 <head> https://github.com/stevenjoezhang/live2d-widget/blob/master/waifu-tips.js#L62 - 绘制叠加在 <body> 上,果然是 canvas - W 前进 AD 转向,smooth…
#web #trick 关于 bookmarklet ,有一个小问题:因为 CSP(content security policy) 限制不能加载外部代码
也即
加载脚本是会被禁止的,据说可以在 CSS 注入 JS 代码... 不太懂
可以用
fetch+eval 也不行呢
其实是网页设置不对... 替换链接为 https://cdn.jsdelivr.net/gh/stevenjoezhang/asteroids/asteroids.js 就可以了
javascript:var s=document.createElement('script');s.type='text/javascript';document.body.appendChild(s);s.src='http://www.websiteasteroids.com/asteroids.min.js';void(0);
也即
javascript:document.body.appendChild(document.createElement("script")).src="http://www.websiteasteroids.com/asteroids.min.js";void(0)
加载脚本是会被禁止的,据说可以在 CSS 注入 JS 代码... 不太懂
可以用
document.location=``
测试以上 URIfetch+eval 也不行呢
其实是网页设置不对... 替换链接为 https://cdn.jsdelivr.net/gh/stevenjoezhang/asteroids/asteroids.js 就可以了
Stack Overflow
Javascript bookmarklet on site with CSP in Firefox
I have a simple Javascript bookmarklet that I put together to run the contents of an appropriate GitHub repository against an external tool:
javascript:(function(){
var isApex = false;
var
javascript:(function(){
var isApex = false;
var