Can't add an iframe in an HTML block.

Can't add an iframe in an HTML block.

by Clarence Prudhoe -
Number of replies: 2
Hi,

I am testing Moodle 2.0 Preview 4 (Build: 20100703), logged in as the Administrator.

I need to add an iframe to an HTML block but the HTML filter won't let me.

I opened Site Administration > Security > Site Policies

and put a check in:
Allow EMBED and OBJECT tags

and put a check in:
Enable trusted content

Then saved the new settings.

Then I tried to follow the instructions concerning Trusted Content:
  • By default Moodle will always thoroughly clean text that comes from users to remove any possible bad scripts, media etc that could be a security risk. The Trusted Content system is a way of giving particular users that you trust the ability to include these advanced features in their content without interference. To enable this system, you need to first enable this setting, and then grant the Trusted Content permission to a specific Moodle role. Texts created or uploaded by such users will be marked as trusted and will not be cleaned before display.
But, there does not seem to be anywhere to grant the Administrator Trusted Content status. I assume the Administrator should be able to do anything, including bypassing the HTML filters. However, when I try to save the iframe tag, the editor deletes the code.

I don't know if this is a bug in Moodle 2.0 or if I have missed a setting.

Thanks for any help.
Clarence Prudhoe

(Edited by Martin Dougiamas to remove heaps of suspicious Javascript - original submission Monday, 5 July 2010, 06:01 AM)

Average of ratings: -
In reply to Clarence Prudhoe

Re: Can't add an iframe in an HTML block.

by Itamar Tzadok -
I think I've seen a recent comment in one of the forums, according to which Moodle 2.0 does not allow iframe but only embed and object tags (hence 'Allow EMBED and OBJECT tags'). smile
Average of ratings: Useful (2)
In reply to Itamar Tzadok

Re: Can't add an iframe in an HTML block.

by Clarence Prudhoe -
Hi Itamar,

Thanks for the heads up. This is how to make it work. I found this in Moodle Tracker:

iframes are not supported in XHTML 1.0 Strict, thus they need to be replaced.

The new form of specifying something similiar to the <iframe> tag is to use the <object> tag. Here is an example:

<iframe id="embeddedhtml" src ="http://www.YourSite.com/SomePage.html" width="100%" height="600"></iframe>

should be

<object id="embeddedhtml" type="text/html" data="http://www.YourSite.com/SomePage.html" width="100%" height="600"></object>

I used the <object> tag and it works fine.

Thanks again,

Clarence

Average of ratings: Useful (3)