19
$\begingroup$

I know that I can embed a CDF file inside a web page by using:

  1. The embed tag.
  2. An object tag with an embed tag inside (better than 1).
  3. Using the JavaScript provided by Wolfram (better than 2).

My question is how can I pass some data to the CDF file. In the case of Flash, there is a flashvars attribute precisely for this, but I can't find the equivalent for this in Wolfram's CDF deployment documentation.

I need this because I plan to embed a CDF in a set of pages that are similar but each for a different set of data. And I want to generate a single CDF for all of them.

If this is not possible in this direction, I would be interested in knowing about solutions in the opposite direction: reading the DOM from the CDF file as this would solve my problem too.

UPDATE (June 16, 2015): This is now possible in CDF Player 10 with CurrentValue["PluginParameters"]. For more information, please see this community thread: http://community.wolfram.com/groups/-/m/t/309578

$\endgroup$
9
$\begingroup$

You cannot import data to a web embedded CDF:

http://www.wolfram.com/player-pro/how-player-pro-compares.html

...that is to say in principle you can't. However if you read this thread:

Deploying Mathematica Content Online

you will note that @Jens demonstrated that it was possible to import data from a URL. However after investigating this I was told by Wolfram that this was a bug that will be closed in future builds so you cannot rely on this.

$\endgroup$
2
  • $\begingroup$ Thank you. I guess I will need to use webMathematica, but this will put more workload on the server to generate over and over almost the same CDF file. In this particular area Flash has an advantage. $\endgroup$ Mar 19 '12 at 2:20
  • 1
    $\begingroup$ With the release of Mathematica 9 URL importing is a free CDF feature. Please see @AndreKuzniarek answer for details. $\endgroup$ Dec 6 '12 at 18:50
20
$\begingroup$

With Version 9, CDF Player is officially supporting import via URL. This is currently the only way to bring any data into a web embedded CDF or notebook, regardless of license level. Other methods are being explored, particular for exchanging data with the surrounding DOM. Stay tuned for more information on this to come.

Please consult the following table for an updated comparison of FreeCDF vs. Enterprise/Player Pro vs. Mathematica functionality:

http://www.wolfram.com/player-pro/how-player-pro-compares.html

and here for more details about FreeCDF vs. Enterprise licensing:

http://www.wolfram.com/cdf/adopting-cdf/licensing-options.html

$\endgroup$
6
  • 2
    $\begingroup$ I gave Andre his first upvote - I'm famous!! $\endgroup$ Dec 6 '12 at 18:33
  • $\begingroup$ Andre I think what is still needed is enabling of JLink and other links (DatabaseLink is enabled of course) providing they are used within the CDF (as opposed to using Mma functionality from another interface). $\endgroup$ Dec 6 '12 at 21:50
  • $\begingroup$ @MarkMcClure You are famous also for rare voting :) $\endgroup$
    – Artes
    Dec 6 '12 at 21:51
  • $\begingroup$ @Artes I can live with that! I do vote, but certainly not whimsically. I generally vote when I feel that I've learned something. As a long time user and parttime consultant, that doesn't happen too often. My students tell me that I'm stingy with points, too. Perhaps, there's a theme? :) $\endgroup$ Dec 6 '12 at 22:02
  • $\begingroup$ @MarkMcClure I'm not opposing with that, but on the other hand every so often good answers get few upvotes while poor ones get too many. I mean your votes are especially important. $\endgroup$
    – Artes
    Dec 6 '12 at 22:23
1
$\begingroup$

Apparently, one of the enhanced capabilities available in an enterprise license of Mathematica is the capability to send data to your CDF file just like when using Flash.

http://www.wolfram.com/mathematica/how-to-buy/industry-individuals.html

Enterprise CDF Deployment

I have not been able to find the documentation for this in Wolfram's site, but I'll update my answer when I do.

UPDATE: As confirmed by Andre Kuzniarek, it is still not possible to send data to the CDF via HTML or Javascript.

$\endgroup$
5
  • $\begingroup$ The enterprise version provides a different signature to the CDF which enables the same features you would get in Player Pro. $\endgroup$ Nov 5 '12 at 22:00
  • $\begingroup$ @david what is not clear to me is that in Player Pro documentation at wolfram.com/player-pro there is nothing that specifically says that you can send data from the HTML to the CDF file. Also, in wolfram.com/cdf/adopting-cdf/deploying-cdf/web-delivery.html there is no mention to special Player Pro parameters. If this parameter exits, what is its name? Not advertising this can slow down CDF adoption. $\endgroup$ Nov 6 '12 at 15:43
  • $\begingroup$ Please see @AndreKuzniarek clarification of Enterprise option and related information. $\endgroup$ Dec 6 '12 at 18:48
  • $\begingroup$ re: your Update. Andre's answer refers to web embedded CDFs. Stand alone CDFs that have been pro signed can import/export etc. $\endgroup$ Dec 6 '12 at 21:48
  • $\begingroup$ Yes I was referring to the web embedded CDF. I made a small edit to make it clear. $\endgroup$ Dec 6 '12 at 23:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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