需求
我需要跳转到这个页面,顺便呢弹个窗,告诉我们执行了
data:text/html,<iframe%20 src="https://blog.youkuaiyun.com/Youyzq?spm=1000.2115.3001.5343" width="100%" height="100%" scrolling="auto" frameborder="no"%20 border="0" ></iframe><script>alert("我是一个小弹窗")</script>
这里会有一个小问题,在导航栏的位置,不要使用中文,不然就会乱码
尽量使用英文和数字
<script>alert(1111)</script>
这样就可以了,为啥会是白屏呢,因为alert
执行完毕了以后,HTML结构才会继续渲染。点击确定
了以后就执行出来了
注意看这里的路径,就是刚才咱们输出的东西。
为什么需要这样写呢?
注意看我这里画框的地方,因为这个网页不是我们部门开发的,是一个投票的平台进行管理的,但是呢他的效果并不是太好,我想把他变成正方形,让参加投票的人,可以直接扫码进行投票,但是现在的三角形,第一不美观,第二也不实用
如何解决这个问题呢?
data:text/html,<html><head><style>body,html{margin:0;padding:0;}img{border: 0;}.popup-show-ewm{position:fixed;top:85px;right:85px;z-index:22;}.popup-backdrop{width:100%;height:100%;position:fixed;top:0;left:0;z-index:20;}</style></head><body><iframe%20 src="https://www.wenjuan.com/vws/vote_wall/UZBZJv6bNe" width="100%" height="100%" scrolling="auto" frameborder="no"%20 border="0" ></iframe><div class="popup-backdrop"></div><div class="popup-show-ewm"><img src="https://www.wenjuan.com/images/get_matrix_img?survey_url=https://www.wenjuan.com/s/UZBZJv6bNe/&box_size=17" alt="" width="120" height="120" /></div></body></html>
这个代码,也是有缺陷的,只能在火狐浏览器
里使用,因为谷歌早已经不支持代码嵌入。(因为不安全)
data:text/html 这句话的意思就是相当于自己创建一个网页,可以在url中写入标签,通过渲染引擎来渲染出来页面
<iframe>
这个标签就是在当前页面,导入其他页面的一个标签