5
$\begingroup$

I teach Economics at University. I often use Mathematica to generate interactive diagrams with demand and supply curves. We also use Blackboard (blackboard.com) to manage our subjects, including assessing students through quizzes and numerical questions. I would like to embed Mathematica in Blackboard, for instance using HTML code. I have tried using Mathematica's Computable Document Format (CDF) but I am not sure where to save the CDF, so that Blackboard can use it. Is there anyone who knows how to embed Mathematica in Blackboard (or any similar eLearning platform)? Thanks, Mario

$\endgroup$
3
  • $\begingroup$ Hello. Mathematica was trialled in several schools in my state last year for the final year math method exam -- as an alternative to a printed exam. I wrote the code for that (and the trial will take place again this year). I don't have any direct experience with blackboard but could an alternative be to conduct your exam in Mathematica and send results to blackboard? Maybe we can chat offline $\endgroup$ Jul 29, 2014 at 0:52
  • $\begingroup$ I think currently Blackboard doesn't allow you to access external URLS for JavaScript and CSS from within HTML files that you upload. This means you will have to try and download all the remote files needed by the CDF plugin embed script, and put them into a directory together with the CDF file and the HTML file that contains the embed code. Then you could try to zip that whole directory and upload it to Blackboards under "Files > upload ZIP file...". I haven't actually tried it because I don't really have much use for CDF files anyway... $\endgroup$
    – Jens
    Jul 29, 2014 at 5:16
  • $\begingroup$ @MikeHoneychurch Mike, yes it would be great to chat offline. You can contact me at mario.fiorini_at_uts.edu.au $\endgroup$ Aug 1, 2014 at 1:14

1 Answer 1

3
$\begingroup$

The following works for me:

Create the CDF file, for example by taking this example code from the docs and creating a new notebook that can be exported in its entirety:

CreateDocument[
 DynamicModule[{x = False, changeCount = 0}, 
  Column[{Checkbox[
     Dynamic[x, (x = #; changeCount++) &], {False, True}], 
    Row[{"x is ", Dynamic[x]}], 
    Row[{"x has been changed ", Dynamic[changeCount], " times."}]}]]]

(*
==> NotebookObject[
 FrontEndObject[LinkObject["hiyxn_shm", 3, 1]], 19]
*)

In the new notebook, follow the steps for CDF Export > Web Embeddable.... Put the CDF in a directory together with an HTML file that uses the generated embed script. Make sure you copy that script using Edit > Copy as plain text and paste it into your HTML file. Since this script calls a Javascript file on the Wolfram server, it will not work with Blackboard.

To make sure I download all the remote files that may be necessary, I view the HTML file with the embedded CDF in Chrome and save it as "web page, complete". This creates a new HTML file which I then edit. It turned out that the Chrome browser figured out an alternative way to embed the CDF that doesn't even require the Javascript file at all. It instead uses an <object> element. In your editor of choice, you can therefore delete the <script> element that is also included. Just leave the code that looks similar to this example:

<object classid="clsid:612AB921-E294-41AA-8E98-87E7E057EF33" width="283"
height="59" type="application/vnd.wolfram.mathematica"><param name="src"
value="Untitled.cdf"><embed width="283" height="59" src="Untitled.cdf"
type="application/vnd.wolfram.mathematica"></object>

Make sure the new HTML file gets put into the same folder as the CDF, and if necessary adjust the path in the above code.

Then create a ZIP file from the entire folder (after verifying that the new HTML file indeed displays the desired CDF).

In Blackboard, go to the Files menu for your course; go to Upload and then Upload .zip file. After uploading it, navigate to the location in your course where you intend to display the HTML page. There, choose Build content, then Create > File.

Give the file a name, and select the checkbox that says FILE OPTIONS > Display in new Window. To link the uploaded file, click the Browse Course button and choose the newly created HTML file from within the folder you uploaded earlier.

I checked that this new file opens and displays the CDF plugin from within Blackboard.

$\endgroup$
1
  • $\begingroup$ Thanks Jens! though it looks like a lot of work. I was hoping to incorporate a Mathematica dynamic graph within a Blackboard question, and then have the students enter the answer directly in Blackboard. Copy and pasting an HTML code in the question text looked a simple and quick way. Your way is probably the only way to do it though. $\endgroup$ Aug 1, 2014 at 1:17

Your Answer

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

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