Mobile Safari and iFrame src attribute

后端 未结 2 1642
我在风中等你
我在风中等你 2021-01-21 08:19

I am trying to set the \'src\' attribute for an iFrame. It works great on FireFox and Internet Explorer. However, when testing on iPad mobile safari changing the \'src\' attribu

2条回答
  •  执念已碎
    2021-01-21 08:23

    In the end I solved this by dynamically creating the iframe and attaching it to the DOM. I also added a timestamp to the id and src attributes in order ensure no caching is being done (though I'm unsure if that truly is necessary).

    var elIFrame = document.createElement("iframe");
    var dt = new Date();
    elIFrame.src = APP_IMAGEPATH + "/loading.gif?dt=" + dt.getTime();
    elIFrame.id = 'newCard2' + dt.getTime();
    elIFrame.frameBorder = 0;
    elIFrame.scrolling = "no";
    elIFrame.style.width = "500px";
    elIFrame.style.height = "1.8em";
    YAHOO.util.Dom.insertAfter(elIFrame, this.pre + "cardMask");
    

提交回复
热议问题