开发者

Injecting JQuery into a live webpage via the DOM and Opera Extensions

开发者 https://www.devze.com 2023-03-25 06:46 出处:网络
I\'m building an Opera Extension. 开发者_如何学JAVAIs it possible to use the includes folder to directly inject jquery into the live html on a webpage.

I'm building an Opera Extension.

开发者_如何学JAVAIs it possible to use the includes folder to directly inject jquery into the live html on a webpage.

I.E. change the background colour of the DOM to say black.

possibly so this script could work.

// The injected script

var elems = document.getElementsByTagName("body");

var arr = jQuery.makeArray(elems);

$(document).ready(function() {
$("body").css("background-color", "#000000");
 $("body").css("color", "#ffffff");
 $(arr).appendTo(document.body);

});

if it is possible could someone please do a tutorial or point me to one as I cant visualise how to do this in my mind.

thanks kev


You could try pulling apart this extension https://addons.opera.com/addons/extensions/details/scripter-script-includer/ to see how he did it.

0

精彩评论

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

关注公众号