4
$\begingroup$

I created a working CDF file on my Mac, and I am trying to embed it into an html page, and although I followed all the steps suggested on the mathematica web embedding page, it is not working (I always get a white page when I try to open my page). This is what I have done so far:

  • I exported my Mathematica code as a CDF standalone "AGN-standaloneClear.cdf", checked and it is working with CDF Player
  • I opened TextEdit, converted to plain text and wrote:

    <html>
    <body>
    <embed src="AGN-standaloneClear.cdf” width=“1380” height=“6792”>
    </body>
    </html>
    

and saved it as test.html into the same folder where the cdf is.

When I try to open it with Chrome the page is completely white however, and if I try to reopen the test.html file it is completely white. I never tried to deal with html, so I think I could be doing some very noob errors that are not even explained in the guides I read so far, but however I don't know what to do.

-EDIT-

Here is the code that generates the white page:

<html>
<head>
</head>
<body>
<script type="text/javascript" src="http://www.wolfram.com/cdf-player/plugin/v2.1/cdfplugin.js"></script>
<script type="text/javascript">
var cdf = new cdfplugin();
cdf.setDefaultContent('<a href="http://www.wolfram.com/cdf-player/"><img  src="prova.png"></a>');
cdf.embed('AGNstandaloneClear.cdf', 1380, 6792);
</script>
</body>
</html>

and here is the one that generates the cropped cdf (http://postimg.org/image/tgqa3bicl/):

<html>
<head>
</head>
<body>
<script type="text/javascript" src="http://www.wolfram.com/cdf-player/plugin/v2.1/cdfplugin.js"></script>
<script type="text/javascript">
var cdf = new cdfplugin();
cdf.setDefaultContent('<a href="http://www.wolfram.com/cdf-player/"><img  src="prova.png"></a>');
cdf.embed('AGNstandaloneClear.cdf', 435, 325);
</script>
</body>
</html>
$\endgroup$
9
  • $\begingroup$ When working with code/HTML, remember to disengage "smart quotes" (like the ones around the width value)- they sometimes cause problems. $\endgroup$
    – cormullion
    Nov 7, 2013 at 18:09
  • $\begingroup$ it is loading the cdf now, thanks. however it is not loading correctly, it is cropped, like if the width and height values are not correcte. however if I modufy height and width values to the correct ones i get the white page again $\endgroup$
    – saimon
    Nov 7, 2013 at 23:17
  • $\begingroup$ You should continue to update your question with more information - perhaps someone can see the problem then... $\endgroup$
    – cormullion
    Nov 8, 2013 at 0:03
  • $\begingroup$ I don't know what informations can I give more... this is the snapshot of how it looks after I modified the cose as cormullion suggested: postimg.org/image/tgqa3bicl $\endgroup$
    – saimon
    Nov 8, 2013 at 8:04
  • $\begingroup$ 6792 seems very large for a web page - my browser window is only 1000 x 1000. But it worked for me (once I'd scrolled the page enough). $\endgroup$
    – cormullion
    Nov 8, 2013 at 10:13

1 Answer 1

3
$\begingroup$

This HTML code works for me:

<html>
<head>
</head>
<body>
<script type="text/javascript" src="http://www.wolfram.com/cdf-player/plugin/v2.1/cdfplugin.js"></script>
<script type="text/javascript">
var cdf = new cdfplugin();
cdf.setDefaultContent('<a href="http://www.wolfram.com/cdf-player/"><img  src="test-embed.png"></a>');
cdf.embed('test-embed.cdf', 435, 325);
</script>
</body>
</html>

The <script> sections were generated by Mathematica version 9.0.1 command File>CDF Export>Web Embeddable.

$\endgroup$
1
  • $\begingroup$ What browser is supported I cannot open http://www.wolfram.com/cdf/test.html with chrome, Firefox or opera on a fedora 64 bit machine $\endgroup$
    – Neel Basu
    Apr 26, 2017 at 13:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.