i have a html page with 2 embed pages
<body>
<embed src ="toolbar.html" type="application/xhtml+xml" width="485px" height="60px">
<embed src="editor.svg" type="image/svg+xml" width="595px" height="842px">
</body>
the first is a toolbar (jquery ui)
the second is an xml page with svg in it.
both pages have scripts.
Is there any way to pass a variable defined in a script from the toolbar to the svg ?
or if that isn’t possible:
is there any way to pass a variable defined in the current document to an embedded page ?
tnx in advance
Turn the
embedelements intoiframeelements, don’t forget the close tags.The W3 – Technical Review – HTML 5 – The
embedelement mentionsso you should rather use
iframeelements instead ofembedelements, which mentions:in which a browsing context is defined as:
You can declaring a global variable in a script you use in the main page.
It is as simple as
var myvariable;You can access the variable from within an iframe using
window.parent.myvariable.The DOM object
window.parentis defined as such:A shortened version is to use
parent.myvariable, aswindowis the root DOM object.Make sure that the domains, protocols and ports of the different documents match.
Unless you want to be presented with a nasty error like: