kopia lustrzana https://github.com/backface/turtlestitch
Merge pull request #2762 from jmoenig/missing-contentWindow-API-docs
Missing "contentWindow" in API documentationpull/95/head
commit
d4b749b906
4
API.md
4
API.md
|
@ -70,14 +70,14 @@ If the iframe and the container do not share domains, you won't be able to reach
|
||||||
and, thus, the API. For that particular case, you should use the `postMessage` mechanism,
|
and, thus, the API. For that particular case, you should use the `postMessage` mechanism,
|
||||||
as follows:
|
as follows:
|
||||||
|
|
||||||
document.querySelector('iframe').postMessage(
|
document.querySelector('iframe').contentWindow.postMessage(
|
||||||
{ selector: <API selector>, params: <param array> },
|
{ selector: <API selector>, params: <param array> },
|
||||||
'*'
|
'*'
|
||||||
);
|
);
|
||||||
|
|
||||||
For instance, to get the value of a variable named "foo", you would do:
|
For instance, to get the value of a variable named "foo", you would do:
|
||||||
|
|
||||||
document.querySelector('iframe').postMessage(
|
document.querySelector('iframe').contentWindow.postMessage(
|
||||||
{ selector: 'getVar', params: [ 'foo' ] },
|
{ selector: 'getVar', params: [ 'foo' ] },
|
||||||
'*'
|
'*'
|
||||||
);
|
);
|
||||||
|
|
Ładowanie…
Reference in New Issue