Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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>
share|improve this question
    
When working with code/HTML, remember to disengage "smart quotes" (like the ones around the width value)- they sometimes cause problems. –  cormullion Nov 7 '13 at 18:09
    
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 –  saimon Nov 7 '13 at 23:17
    
You should continue to update your question with more information - perhaps someone can see the problem then... –  cormullion Nov 8 '13 at 0:03
    
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 –  saimon Nov 8 '13 at 8:04
    
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). –  cormullion Nov 8 '13 at 10:13

1 Answer 1

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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