我正在动态地生成iframe及其id。
现在我遇到了一个问题,那就是Id是否已经存在。
我的代码是,
function createIframe(intxnId){
alert("Id is : "+"$('#"+intxnId+"')");
if($("'#ch"+intxnId+"'").length == 0){
alert("Creating the new Iframe intxnId is: " +intxnId);
我正在为许多不同的随机网站动态生成iframe,并且我倾向于在我的javascript控制台中得到这个错误(不一定使用这个url):
Unsafe JavaScript attempt to access frame with URL http://localhost:3000/results/ from frame with URL http://www.apple.com/iphone/. Domains, protocols and ports must match.
为什么我会得到这个错误?有没有办法摆脱它?
因此,我在javascript中与iframe交互的唯一两次是在动态加载if
我有一个用普通javascript动态创建的iframe。当通过常规方式从静态页面调用它时,它工作得很好,但是当从Jquery加载的页面调用它时,我得到了一个'myIframe is null‘错误。
var link = 'http://www.blah.com'
var iframe='<iframe class="adframe" id="randomnumberhere" name="widget" src="#" width="300" height="250
我张贴html内容到服务器端,并将其转换为PDF和流文件回来。但我无法使用以下命令下载该文件:
var formData = new FormData();
formData.append("htmlContent", strHTML);
var request = new XMLHttpRequest();
request.open("POST", "RenderHtmlAsPDF.jsp");
request.send(formData);
当我创建一个动态表单并将针对它的html内容发布到iframe时,Download就起作用了。但我受到
我有一个页面在那个特定的'‘中有一个iframe,我正在用下面的代码通过ajax调用来动态地编写HTML代码。
<script>
$(document).ready(function(){
$.post(URL,
function (data) { //here it retruns the HTML code
$("body").html('<iframe style="width:100%;height:384px;"></iframe>');