开发者

chrome extension inject in frameset code

开发者 https://www.devze.com 2023-02-01 22:08 出处:网络
i develop some extension for google grome i inject at document_end event my js (+jquery) i set in manifest allFrames: true

i develop some extension for google grome i inject at document_end event my js (+jquery) i set in manifest allFrames: true my match url has frameset

my goal get element by id inside one of frame

i do

//wait for load my fram开发者_如何学运维e
$("frame[name='header']).load(function() {
    //here I need get element by id inside this frame
});

how to do this properly?

PS: my frame is from the same domain


You dont need to do document load, I assume your doing this from a content script. Just place the "run_at" manifest to be document_end and within your content script you check if the current URL is that frame page, then you will be in that Domain.

Something like this:

if(location.href == 'http://someweb.com/path/to/page.html') {
  var foo = document.getElementById('foo')

Something like that will get you started.

0

精彩评论

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

关注公众号