开发者

Safari extension modifying to an iframe within main page

开发者 https://www.devze.com 2023-02-13 12:05 出处:网络
Hi I\'ve wrote simple Safari extension to display QR code with url to currently visiting website..This is part of code where I am appending the code to page..

Hi I've wrote simple Safari extension to display QR code with url to currently visiting website..This is part of code where I am appending the code to page..

document.body.insertBefore(qrdisplay, document.body.firstChild);
   qrdisplay.appendChild(img);

All is wokring, but what sucks is, the code appends too to an iframe content..Actually nasty problem if every site contains facebook like box and lot of other crap:D Can I somehow append the element only to main body?When I would use some kind of "body child of body" selector it wouldnt work..It simply cant as there are two independent DOMs?Am I righ开发者_开发技巧t?

Thanks for your advice, I hope you understand to my problem..


I think you need to check if window === window.top before running your appending code.

0

精彩评论

暂无评论...
验证码 换一张
取 消