Mobile Safari and iFrame src attribute

后端 未结 2 1720
我在风中等你
我在风中等你 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:39

    Are you sure that the variable iFrame0 is actually pointing the iFrame DOM object and not some empty object or other element using the same ID (a DIV for example)? Maybe you could try to check the initial src to see if it's what you expect (i.e. '.../loading.gif').

    Try to access the frame with the following:

    var frameObj = document.frames ? document.frames['iFrame0'] : document.getElementById('iFrame0'),
        frameWin = frameObj.contentWindow || frameObj;
    

    And then try to modify its src:

    frameWin.src = '..../newurl.gif';
    

提交回复
热议问题