Popeye
Popeye

Reputation: 1558

controlling iframe margin and source from js (js inside iframe)

I have an Iframe. What I want to do is to change the src and margins of the iframe from the javascript which is included in the document already open in iframe.

I have already tried the following but no use -

document.popiframe.document.body.innerHTML="blah";
document.getElementById( 'popiframe' ).setAttribute( 'src', '' );
$('.popiframe').attr('src', "about:blank");

How can I do this?

Upvotes: 0

Views: 99

Answers (1)

Laurent S.
Laurent S.

Reputation: 6947

An iframe is a window in a window, you change the page displayed there (= not the src attribute) like you would change it in any other window :

window.location.href = "http://www.google.com";

changing the margin around the iframe isn't possible from where I see it...

Upvotes: 1

Related Questions