I've created an iframe from any website. I would like to define a specific region. Is it possible to do that?
I've created an iframe from any website. I would like to define a specific region. Is it possible to do that?
So I understand, you want to have access to the html of the site loaded by the iframe, there are several ways to do it, one of them would be a stylized selector to access the body of the site from the loaded iframe.
var iframeBody = $('body', $('iframe')[0].contentWindow.document); // Acesso ao body do site jsfiddle
console.log(iframeBody.find('ul').width()); // pega a largura do menu do site jsfiddle
console.log(iframeBody.find('ul').height()); // pega a altura do menu do site jsfiddle
<iframe width="100%" src="https://jsfiddle.net/"></iframe>
Seeworkedon jsfiddle
Once you have access to the object, you simply use the .width / height functions to pick up the width and height and perform other customizations as needed.
I believe this is what you want:
window.frames['iframe01'].document.body.innerHTML
Or try this for Firefox or Chrome:
window.frames[0].document.body.innerHTML
You can also:
Use div
and use JQuery to load just the part you want:
$('#target-div').load('http://www.mywebsite.com/portfolio.php #portfolio-sports');