Iframe src being overridden

Hi There,

I’m trying to use JS to target an iframes src attribute, for the purpose of reloading in page. Here’s the JS I’m using, as you can see it simply reselects the src to force a reload.

function refreshIframe() {
var ifr = document.getElementsByName('Right')[0];
ifr.src = ifr.src; }

Then my button calls the function onclick.

I use raw content, or text box to put my iframe in, including the src attribute
image

But, then cornerstone seems to move my src to a data-src attribute, and fill the src attribute with some jargon.

I’ve tried forcing the src to stay as I require, by using custom attributes, but this does not work.
image

Is there any way around this? I don’t really understand why CS changes the src to data-src.

Thanks
Tom

Hi Tom,

Thanks for reaching out.
It seems that it is an issue with the custom JavaScript coding and custom embed code, which is beyond the scope of theme support. I would suggest you hire a developer who can assist on this or you can avail of our newly launched service called One, where we answer the questions beyond normal theme support.

Thanks

Hey @tristup,

I actually managed to figure this out just now. For future personages, the issue was that any Lazy Loading plugin (image optimizing solutions included), will make the problematic changes I described above to all images and often iframes - as was in my example.

In Smush, the plugin causing me trouble, you can manually exclude iframes from the optimization.

Problem resolved. :slight_smile:

Hi @el3ctrofuzz,

Great that it is resolved now :slightly_smiling_face:

Thanks

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.