[x3d-public] Holger, please change Cobweb page to include something like this:
John Carlson
yottzumm at gmail.com
Fri Jan 8 23:49:36 PST 2016
Holger, can you provide insight as to why the this code logs that Cobweb disabled first time through? I have been ignoring this, but I think it’s time to address it. Does the page need to be loaded before this is called? Thanks!
John
// HTML5 with iframe reference to cobwebframe.html
<iframe id='cobwebframe' src="cobwebframe.html"></iframe>
<!— snip —>
var content = $('textarea#xml').val();
var cobwebWindow = document.getElementById("cobwebframe").contentWindow ;
var cobwebEle = cobwebWindow.document.getElementById("x3dele");
if (typeof cobwebWindow.X3D !== 'undefined') {
var browser = cobwebWindow.X3D.getBrowser(cobwebEle);
browser.replaceWorld(browser.createX3DFromString(content));
} else {
console.error("Cobweb disabled. Use Firefox.");
}
———— cobwebframe.html ————
<!DOCTYPE html>
<html>
<head>
<title>Cobweb Iframe loader</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="https://cdn.rawgit.com/create3000/cobweb/master/stable/1/1.21/cobweb.css"/>
<script type="text/javascript" src="https://cdn.rawgit.com/create3000/cobweb/master/stable/1/1.21/cobweb.min.js"></script>
<style>
X3D {
width: 192px;
height:108px;
}
body {
margin:0px;
padding:0px;
}
</style>
</head>
<body>
<X3D id='x3dele' cache='false' url='"ArchPrototype.x3d"'>
<p>Your browser may not support all features required by Cobweb!</p>
</X3D>
</body>
</html>
> On Jan 9, 2016, at 1:37 AM, John Carlson <yottzumm at gmail.com> wrote:
>
> Thanks to Andreas Plesch. Holger, could you add something like this to the Cobweb page to document how to build xml on the fly and submit it to Cobweb for viewing? Thanks, John
> For an frame outside an iframe, xml being an array of strings.
> var content = xml.join("");
> var cobwebWindow = document.getElementById("cobwebframe").contentWindow ;
> var cobwebEle = cobwebWindow.document.getElementById("x3dele");
> if (typeof cobwebWindow.X3D !== 'undefined') {
> var browser = cobwebWindow.X3D.getBrowser(cobwebEle);
> browser.replaceWorld(browser.createX3DFromString(content));
> // etc.
> }
>
> and something else for loading inside the same document (which I can get from Andreas, I think).
>
> John
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20160109/fc232b03/attachment.html>
More information about the x3d-public
mailing list