IE8, iframes, Moodle incompatibility?

IE8, iframes, Moodle incompatibility?

by Jennifer Perkins -
Number of replies: 7

I am working on a Moodle course in which I am placing a number of videos within one resource and using iframes and dynamic HTML to switch between the videos. I first designed this using "Compose a Web Page" in Moodle 1.9 but recently upgraded to Moodle 2.0. Unfortunately, the upgrade somehow screwed up the dynamic HTML, so I switched over to the resource "Add File" and uploaded the necessary files (HTML source file, video files, and one image to serve as a placeholder). This is working fine in FF, Opera, Chrome, and Safari, but when I test in IE8, the iframe does not function--all I see is a blank box that is flickering.

This problem does not appear to be the dynamic content but, rather, the iframe itself, as I removed the video portion of the HTML and left only the iframe with image--and IE8 just sits and sputters. However, it works fine in IE8 if the page is outside Moodle, so it seems that there's some iframe/Moodle problem going on. I know it's best not to use iframes at all, but I can't figure a better way to provide a series of videos with a side menu of options. (See image of my format.) If you have an idea that would work better, please tell me (although anything with .xml isn't going to work).

Any ideas on why this iframe would work fine in all browsers tested except Internet Explorer 8? And any ideas on what to do?

Thanks so much for any input!

Attachment iframes_dynamiccontent.jpg
Average of ratings: -
In reply to Jennifer Perkins

Re: IE8, iframes, Moodle incompatibility?

by Itamar Tzadok -

I've just managed to make it work on 1.9 with iframes (but not with objects). You need to create the iframe dynamically.

So suppose you have an identified div, say 'iframeholder'. The link should pass the url as a parameter to a function that does the following

  • create an iframe element
  • set the iframes src attribute with the url
  • empty the div's innerHTML
  • append the iframe element to the div

The code may look something like:

var obj=document.createElement('iframe');
obj.setAttribute('src',url);
obj.width='500px';
obj.height='400px';
var holder=document.getElementById('iframeholder');
holder.innerHTML='';
holder.appendChild(obj);

hth smile

In reply to Itamar Tzadok

Re: IE8, iframes, Moodle incompatibility?

by Jennifer Perkins -

Yikes. This does not look like fun; I'm not so experienced in coding. Thank you for the info, though--it may be my only option to learn quickly.

What is weird is that I have no troubles with IE8 and iframes in Moodle 1.9--I created a web page with a table of labels and linked those labels to an iframe area, and it came together beautifully. As soon as I plopped the HTML into the same type of page in Moodle 2.0, the iframe wouldn't work in IE8.

Thanks again. I appreciate any input!

JP

In reply to Jennifer Perkins

Re: IE8, iframes, Moodle incompatibility?

by Itamar Tzadok -

Actually it's quite fun, but here is another possible solution which does not require coding other than html.

Create a database activity.

Add two text fields: WWW and URL (you can use different names if you prefer)

In the single view template toggle html (<>) and enter the following html:

<iframe src="http://||WWW]].||URL||" width="500" height="400">...</iframe>

Replace || with square brackets (two [ on the left side and two ] on the right side).

When you add an entry put www in the WWW field if the url has www. Put the rest of the url in the URL. So for instance to display this thread you should put nothing in the WWW field and moodle.org/mod/forum/discuss.php?d=164086 in the URL field.

WWW:

URL: moodle.org/mod/forum/discuss.php?d=164086

Save and view in the single view. It seems to work in 1.9 in both FF and IE8. With a bit of luck it will work for you too. smile

In reply to Itamar Tzadok

Re: IE8, iframes, Moodle incompatibility?

by Jennifer Perkins -

Hi, Itamar. I got interested in database activities through Moodle to see what they're capable of, so I came back to your notes here. I have a question: When you say to enter the iframe line in the html of the single-view template, where do you mean to enter it? Do I delete any of the code already there and replace it with this, or do I add this code somewhere in the middle or at the end? I'm rather perplexed in that regard. I'm attaching a screenshot of the html code as it stands, without the iframe code. Thanks!

Attachment sourcecode.png
In reply to Jennifer Perkins

Re: IE8, iframes, Moodle incompatibility?

by Jennifer Perkins -

Ah, I think I may have figured out my problem. I added the code to the end in Moodle 2.0, but when I do, Moodle actually removes it! Seems not to like the iframe code at all! When I do the same thing in Moodle 1.9 (which I have on a different domain), the iframe is created, as you directed. So ... the iframe thing seems to be pretty much out of the question for Moodle 2.0, I assume.

In reply to Jennifer Perkins

Re: IE8, iframes, Moodle incompatibility?

by Itamar Tzadok -

Yes, but you can achieve the same effect in Moodle 2.0 (as well as in 1.9.x) with the object tag:

<object data="http://[.[WWW].][.[URL].]" width="500" height="400">...</object>

Note that I removed the . between the WWW and URL because it will break the link if the www is omitted (e.g. in http://moodle.org). Instead you should enter www. (that is, add the dot to the www) in the WWW field.

hth smile

In reply to Itamar Tzadok

Re: IE8, iframes, Moodle incompatibility?

by Humberto Sánchez Jiménez -

Very late gratitude, thanks a lot, this solve the problem for me at this time, I just only needed to take the movie link to put it in there.