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

关于访问网页带有iframe内嵌网页的网址时修改CSS样式 #17

Open
CXTretar opened this issue Aug 22, 2018 · 4 comments
Open

Comments

@CXTretar
Copy link

当浏览器访问带有iframe内嵌网页的网址时,怎么通过如何注入JS修改内嵌网页的样式呢,例如这个界面
1534904114932
护眼模式的样式只能更改导航栏部分,不能更改内容区域。

@zhongwuzw
Copy link
Owner

如果是iframe是同域的话,针对每个iframe添加MutationObserver,然后做出对应的Style即可。

如果不是同域,上面的方法行不通,只能使用-webkit-filter应用到html tag上,简单的实现夜间模式或护眼模式。

@CXTretar
Copy link
Author

好的,谢谢抽空回答!

@zhongwuzw
Copy link
Owner

@CXTretar 嗯,这个功能确实需要优化,所以我重新打开会比较好哈。

@zhongwuzw zhongwuzw reopened this Aug 22, 2018
@CXTretar
Copy link
Author

这样就再好不过了,iframe跨域的问题困扰我很久了,Thanks♪(・ω・)ノ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants