Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

插入一段 script 标签是否支持给标签添加 type 属性? #1066

Closed
yiliang114 opened this issue Apr 25, 2024 · 5 comments
Closed

Comments

@yiliang114
Copy link

使用方式:

image

如截图中的使用方式,会默认在 html 中添加一段 script 标签,但是似乎仅限于 script 标签,而不能为 script 标签添加 type、async 等属性

image

目前似乎还不支持?

https://github.com/avwo/whistle/blob/d8991cf569288e6979632477248ced28a46c9862/lib/inspectors/weinre.js#L9C5-L9C21

@avwo
Copy link
Owner

avwo commented Apr 26, 2024

这样注入会有什么问题吗?js 注入还不支持,可以试试 html 协议:https://wproxy.org/whistle/rules/htmlAppend.html

@yiliang114
Copy link
Author

普通的 js 直接被 script 标签包裹嵌入没有问题,但是如果 js 代码中包含 import 之类的 es 代码,script 标签上需要带上 type="module" 才可以执行,否则嵌入的 js 执行就出错了。

@avwo
Copy link
Owner

avwo commented Apr 26, 2024

下个版本加上,你先用 https://wproxy.org/whistle/rules/htmlAppend.html 嵌入

@yiliang114
Copy link
Author

下个版本加上,你先用 https://wproxy.org/whistle/rules/htmlAppend.html 嵌入

🙇‍♂️

@avwo
Copy link
Owner

avwo commented Apr 28, 2024

重新安装 Whistle 并重启,新版可以通过 lineProps://module 设置 type:

https://xxx js://xxx lineProps://module

也可以用来设置 defer async crossorigin

@avwo avwo closed this as completed Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants