Wolfram Computation Meets Knowledge

Mathematica Q&A Series: CDF Embedding in a Nutshell

Got questions about Mathematica? The Wolfram Blog has answers! We’ll regularly answer selected questions from users around the web. You can submit your question directly to the Q&A Team.

This week’s question comes from Tom, a teacher who wants to post his lessons online:

How can I use CDF to include Mathematica content on web pages?

Read below or watch this screencast for the answer (we recommend viewing it in full-screen mode):

We’re being asked this question more and more, and I am really glad to see how quickly the Computable Document Format (CDF) is being adopted. Whether you want to deliver your CDF content on your website or blog or as a desktop application, Mathematica 8.0.4 makes it quick and easy with a new CDF Web Deployment Wizard.

Once you’ve created your interactive content, select the cell you want to embed in your website. Choose File » Deploy » Embed in HTML… to begin processing your selection:

CDF Web Deployment Wizard

Just follow the steps in the wizard; the last step will provide a few lines of JavaScript code. Paste that code into the HTML of your web page where you want your CDF to appear.

The CDF Standalone Deployment Wizard (File » Deploy » Standalone…) provides the same simple process for saving desktop apps.

If you host your own WordPress site, you can easily add CDF content to your posts or pages with the Wolfram CDF Plugin for WordPress. You will need to host the blog yourself or have permissions to upload supplemental files that the blog can access.

Mathematica 8.0.4 also includes new functions for deploying CDFs programmatically. Use CDFDeploy and CDFInformation to create your CDF file and get the code fragment for embedding.

For further details on CDF deployment, see the Deploying CDF web page.

Download this post as a CDF file.

If you have a question you’d like answered in this blog, you can submit it to the Q&A Team. For daily bite-sized Mathematica tips, follow our @MathematicaTip Twitter feed.

Comments

Join the discussion

!Please enter your comment (at least 5 characters).

!Please enter your name.

!Please enter a valid email address.

9 comments

  1. Thanks for the useful webcast. I’d love to use CDF embedded in my webpages, but since I only have linux computers, it is somewhat frustrating. Is there any update on when the linux browser CDF plugin will become available, and what is the hurdle in providing such a plugin?

    Reply
  2. Hi, Vitaliy! Could you, please, provide some tips on deploying files to mediawiki sites?

    Reply
  3. Will CDF files ever work within iOS browsers?

    Reply
  4. Michael, we are currently working on this functionality and recently released the preview blog post. Please have a look here: https://blog.wolfram.com/2012/02/17/a-preview-of-cdf-on-ipad/

    Alex and D, thank you for the feedback, we will pass along your requests to the development teams.

    Reply
  5. This is very exciting. I wonder how simple it would be for a teacher in physics to make small interactive presentation for different topics for the students. I see a lot of potential in this form of presentation.

    Reply
  6. Hi! I am posting CDF content at a wikispaces site, and so far, it’s great. I am wondering though… when I reveal the animation controls and type a number in the input area… nothing happens or sometimes is displays a partial error message that I can’t quite see. What do I need to do to insure users can use the slider as well as entering values in the input area?

    Tom

    Reply
  7. When I post manipulate scripts as web-embedded cdf files, the manipulate frames appear smaller than intended. The do not seem to conform to the size provided by the embedding script. Is there a straightforward way to enlarge the frame and its contents on the web page? Browsing around has so far not turned up a solution.

    Reply
  8. Thank you for the reply. Unfortunately, the messages on that forum seem to be getting very few replies. It looks like the Wolfram Community Forum might be in need of some publicity. I did post there. It was the third post from the top when last I looked.

    http://community.wolfram.com/

    How to increase the size of a CDF on screen
    CREATED BY: Math Lind | 3 hours ago BY: Gary Palmer
    GROUPS: Wolfram CDF Player, Wolfram|Alpha

    Reply