Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Remove sandbox attribute from iframes?

  • diana_is_here
  • diana_is_here's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
6 months 2 days ago #251494 by diana_is_here
Remove sandbox attribute from iframes? was created by diana_is_here
==================
Your LimeSurvey version: 6.0.6
Own server or LimeSurvey hosting: own
Survey theme/template: fruity
==================
Hi everyone!

I was having trouble with my iframes in limesurvey, which are displayed but interaction is disabled. I realised this is because whenever I include an iframe, limesurvey automatically adds the sandbox attribute: sandbox="allow-scripts allow-same-origin" . Is there any setting to remove this??

I had designed a solution using embedded forms that I used just a few months ago, but after the recent limesurvey updates it no longer works becuase of the sandboxing :(

Thanks for any help on this!

Please Log in to join the conversation.

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 months 1 day ago - 6 months 1 day ago #251514 by tpartner
Replied by tpartner on topic Remove sandbox attribute from iframes?
The editor is adding that attribute.

Use source mode to bypass the editor and enter the iframe html directly.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 6 months 1 day ago by tpartner.

Please Log in to join the conversation.

  • diana_is_here
  • diana_is_here's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
6 months 1 day ago #251516 by diana_is_here
Replied by diana_is_here on topic Remove sandbox attribute from iframes?
Thank you so much for the quick reply!

Please can you clarify what you mean by source mode? I thought that's what I was using, but I'm probably missing something basic here, sorry!

Here's a test example I created earlier, in a test survey question.

This is the question editor. It shows a button and an iframe I created as a test. Whenever I want to edit this, I click on the source button and enter my code there. Is this what you mean by source mode?
 

In this source mode, I might add something like this:
 

I click 'OK' to enter the source. When I open the source window again, the sandbox attribute is added automatically. If I remove it, it just gets added again.
 

Any further pointers would be greatly appreciated!

Please Log in to join the conversation.

  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 months 1 day ago #251522 by holch
Replied by holch on topic Remove sandbox attribute from iframes?
Disable the editor. Probably, whenever you open the field to edit it with the editor in WYSIWYG mode it adds this.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

Please Log in to join the conversation.

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 months 1 day ago - 6 months 1 day ago #251535 by tpartner
Replied by tpartner on topic Remove sandbox attribute from iframes?
As this is a regression from previous versions, please file a bug report - bugs.limesurvey.org .

In the meantime, you can try this (untested) hack - use JavaScript to remove the attribute and then reload the iframe.

Extend your survey theme and add this to the end of your custom.js file.

Code:
$(document).on('ready pjax:scriptcomplete',function(){  
  $('iframe').each(function(i) {
 
    $(this).removeAttr('sandbox').attr('src', $(this).attr('src'));
  });
});

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 6 months 1 day ago by tpartner.

Please Log in to join the conversation.

  • diana_is_here
  • diana_is_here's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
6 months 1 day ago - 6 months 1 day ago #251537 by diana_is_here
Replied by diana_is_here on topic Remove sandbox attribute from iframes?
Thank you holch for the editor suggestion, you're a star! I disabled the editor and I was able to finally remove those iframe attributes!

I wasn't sure how to disable the editor at first, so if there are any other limesurvey newbies reading this, this is what I did:
go to account (top right corner) > Personal settings > set HTML editor mode: Sourcecode text

Thank you tpartner for the suggestion! I managed to get around the issue by changing the editor, I pretty much only use the source mode anyway. But really good suggestion for the future. I'll submit a bug report.

I am truly grateful you guys are available to help out! :)
Last edit: 6 months 1 day ago by diana_is_here.

Please Log in to join the conversation.

  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 months 1 day ago #251538 by holch
Replied by holch on topic Remove sandbox attribute from iframes?

Thank you holch for the editor suggestion, you're a star! I disabled the editor and I was able to finally remove those iframe attributes!

Well, it was actually Tpartner that figured out where the issue is. I was just emphasizing that whenever you open this in WYSIWYG mode it might "correct" your code inserted in source code mode.

But great that you could get around this issue through disabling the WYSYWYG editor. But as Tpartner I think that it would be important to create a bug report, so this can be fixed. When you created the bug report, it would be great if you could post the link to it here, so we can follow the progress and eventually add notes to the bug report to emphasize it.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

Please Log in to join the conversation.

  • diana_is_here
  • diana_is_here's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
6 months 1 day ago #251544 by diana_is_here
Replied by diana_is_here on topic Remove sandbox attribute from iframes?
I've submitted a bug report: on the limesurvey bug reporting plaform linked by tpartner above, it is bug id 19197
(forum won't accept my post with the actual link....)

Hope this helps others facing this issue.

Thanks again for your help!
The following user(s) said Thank You: DenisChenu, tpartner

Please Log in to join the conversation.

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 months 1 day ago #251562 by tpartner
Replied by tpartner on topic Remove sandbox attribute from iframes?

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

Lime-years ahead

Online-surveys for every purse and purpose