Iframe question

Hi All,

A client had an image in a course I built them that they change regularly and they wanted to do it without having to resubmit a SCORM to an LMS when it needs changed.

I suggested an iframe, which they used. The image is being hosted as a resource activity within the Moodle-based LMS.

This is their issue below; this goes beyond my current level of expertise with iframes, so I wondered if anyone had done anything similar. Thanks!

We were able to include the link to the image without a problem (without iframe tags or a specific embed code), but when the image is updated, the module still shows the original version.

Because we want the image to update without changing the link in the module, we are replacing the image with one with the same name. Is there some additional caching within the iFrame that could be preventing it from fetching the new image?

Some alternatives could be to host the image elsewhere, but we don’t want the image to be fully public, nor require authentication into another system inside the module.

There is also an option to upload some Embedded Content inside the iFrame. Could this be used to hold a basic HTML package that contains the same reference to the image, but with some additional logic for some kind of cache-busting?

Or are there any alternatives to allowing an image in the module to be easily updated?

It’ll most likely be the web browser that’s caching the image. To check, you can:

But I guess Moodle could also be caching the image in some way. Equally it could be a local proxy server that’s doing it.

Or are there any alternatives to allowing an image in the module to be easily updated?

Yes… if it’s just an image, why not use the Graphic component’s ‘external image’ option?

Could this be used to hold a basic HTML package that contains the same reference to the image, but with some additional logic for some kind of cache-busting?

Yes, although this can be surprisingly challenging to do in such a way it’s absolutely guaranteed to work. I won’t go into the details here is it’s kind of out of scope of the forum, but you can read more about it in this stackoverflow post.

2 Likes

Thanks a lot Matt, I’ll pass this on to my client.

All the best
Craig