iframe源与变量 [英] Iframe source with variable

查看:93
本文介绍了iframe源与变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有几个问题:


  1. < iframe src =/ index .php>< / iframe> 与HTMLIFrameElement相同?

  1. Is <iframe src="/index.php"></iframe> the same as HTMLIFrameElement ?

为什么

<iframe src="data:text/html;base64,aHR0cDovL2V4YW1wbGUuY29t"
    height=1280 width=800></iframe>

工作正常,但

a=document.getElementsByTagName('body')[0];
b=document.createElement('iframe');
b.src="data:text/html;base64,aHR0cDovL2V4YW1wbGUuY29t";
a.appendChild(b);

不工作?我的意思是在DOM HTMLIFrameElement src我可以把函数与编码的字符串。是否可以在src变量中编码字符串?

does not work? I mean in DOM HTMLIFrameElement src I could put function with encoded string. Is it possible to encode string only in src variable?


推荐答案

URI方案用于直接嵌入数据。

The Data URI scheme is for direct embedded data.

data:text/html;base64,aHR0cDovL2V4YW1wbGUuY29t

表示具有http://example.com的HTML页面

Means a html page with "http://example.com" as its sole content.

您可能希望http://example.com src

这篇关于iframe源与变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆