Message Boards Message Boards

2 Replies
1 Total Likes
View groups...
Share this post:

Help with embed code for cdf file in Moodle Sandbox LMS

I need help embedding cdf files into a Moodle Sandbox LMS site. Ideally I'd like to embed the cdf so that if the computer does not already have a cdf player installed, the computer will automatically download when the file is started.

Here is the code I have attempted to enter:
<script type="text/javascript" src=""></script>
<script type="text/javascript">
var cdf=new cdfplugin ( );
cdf.embed("", 700, 700);

This is what I get back after updating the HTML source editor:
<script src="" type="text/java script"></script>
[u]<script type="text/javascript">// ![CDATA[
var cdf=new cdfplugin ( );

cdf.embed("", //]]></script>

Why does it remove the first <script type="text/javascript" bit of code? And what does it not like about the underlined code?

Any help on this matter is much appreciated.
POSTED BY: Lynette McDougal
2 Replies
I looks like the html editor in moodle is messing up the javascript code. Maybe this is because it was never meant to be used for embedding javascript like this?

If this continues to be an issue, this is more of an issue of how Moodle is parsing your html and javascript, so you may want to go to a forum about Moodle for help with that.

Another alternative if that you could include your code in a .js file and use that instead. For example, you would put the following in a file called tempsimcdf.js
var cdf=new cdfplugin ( );
cdf.embed("", 700, 700);
and then you would have the following put into your webpage:
<script type="text/javascript" src=""></script>
<script type="text/javascript" src="location/of/the/file/here/tempsimcdf.js"></script>
I don't think that's 100% right, but it's the general idea. You want to keep all your javascript in files instead of writing out the javascript in what whatever dialog you are using for Moodle.
POSTED BY: Sean Clarke
Thanks. Doesn't work, so I'll move over to Moodle for support.
POSTED BY: Lynette McDougal
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract