将 iframe 更改为包含 iframe 的脚本
change iframe to script includes the iframe
我有这部分代码:
<div class="embed"><iframe id="iframe" src="<?php echo DOMAIN_NAME; ?>demo?q=<?php echo $number;?>"><body></body></iframe></div>
我想制作一个包含这个iframe的异步脚本。所以最后我会给我的客户端异步脚本代码而不是 iframe。我想这样做有一个主要原因。如果我的网站关闭了,我不想降低我的客户发布我的 iframe 的网站/门户的速度。
当有人点击嵌入div 时,会给我的客户一个 iframe。 我想给出一个异步脚本而不是这个 iframe。可能吗?有什么想法吗?
你的意思是像
var cosnikFrame = document.createElement("iframe");
cosnikFrame.width=450;
cosnikFrame.height=300;
cosnikFrame.setAttribute("scrolling","no");
cosnikFrame.style.border=0;
document.body.appendChild(cosnikFrame);
cosnikFrame.src="http://example.com/demo.php?q=12aA1b35A4a";
或者使用例如 jQuery 在加载后推迟到:
$(function() {
$("body").append('<iframe width='450' height='300' scrolling="no" style="border:0" src="http://example.com/demo.php?q=12aA1b35A4a"></iframe>');
});
相关文章:
- 使用php脚本验证访问者的年龄,并在不刷新的情况下根据结果加载iframe
- 动态创建的iframe中的window.onerror在lne 0处给出脚本错误
- 是否可以添加<脚本>添加'_someTag'到iFrame中的URL
- 在Perl CGI脚本中捕获iframe返回值
- 如何检测何时执行 iframe 脚本
- 如何以编程方式将内容脚本添加到 iframe 文档
- 没有在带有IE-FF的IFrame中运行的脚本是可以的
- 如何使用java脚本将iframe的src设置为当前访问的站点
- 如何将数据从注入的内容脚本传递到iframe
- 插入<脚本>使用jQuery将其转换为iframe
- 如何使用jquery或vanillajavascript从iframe中获取两个脚本src
- 我想在Iframe Javascript PHP的帮助下,将单个ajax上传器脚本转换为多个上传器
- 当尝试登录instagram时,带有Selenium的Phantomjs不处理iframe Java脚本
- 如何访问iframe's来自用户脚本的javascript
- IFRAME和谷歌应用程序脚本中的NATIVE模式
- 实时在更改时重新加载iframe脚本
- IFRAME沙盒中的Google OAuth2和应用程序脚本
- 是否可以阻止远程脚本在 iframe 中加载
- 在iframe脚本中禁用超链接
- 显示来自另一个网页/ IFRAME脚本的内容