vinnitu
vinnitu

Reputation: 4364

chrome extension inject in frameset code

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 frame
$("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

Upvotes: 2

Views: 666

Answers (1)

Mohamed Mansour
Mohamed Mansour

Reputation: 40169

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.

Upvotes: 1

Related Questions