Issue with iframe allow attribute being removed | XM Community
Skip to main content
Solved

Issue with iframe allow attribute being removed

  • June 17, 2025
  • 11 replies
  • 144 views

artem.alekhin
Level 1 ●
Forum|alt.badge.img+2

Hi there,
We're trying to embed an iframe in one of our questions that requires microphone access. However, when we save the question, the allow attribute is being removed. Is there any way to prevent this behavior?

 <iframe 
src="http://myurl.com"
allow="microphone; camera"
style="width:100%; height:600px; border:none;">
</iframe>

 

Saved end result

 <iframe 
src="http://myurl.com"
style="width:100%; height:600px; border:none;">
</iframe>

 

Best answer by Adeep

Hi ​@artem.alekhin I’ve tried this on my end and it worked. Please review the code below and give it a try.

 

Qualtrics.SurveyEngine.addOnload(function () {
    var iframe = document.createElement('iframe');
    iframe.src = 'https://akashdeep02007.github.io/Qualtrics---Redirect-URL/redirect.html';
    iframe.width = '100%';
    iframe.height = '600px';
    iframe.allow = 'camera; microphone; autoplay';
    iframe.style.border = 'none';
    this.getQuestionContainer().appendChild(iframe);
});

11 replies

Forum|alt.badge.img+2
  • QPN Level 2 ●●
  • 20 replies
  • June 17, 2025

Are you trying to add a question so that the respondent can record their answer? 


artem.alekhin
Level 1 ●
Forum|alt.badge.img+2
  • Author
  • Level 1 ●
  • 10 replies
  • June 17, 2025

@KathyM its a bit more complex then just a recording. But yes, an iframe needs an access to microphone and camera. 


Forum|alt.badge.img+2
  • QPN Level 2 ●●
  • 20 replies
  • June 17, 2025

Right, but I think that Qualtrics has restrictions unless you have the Video Response question type. But even so, I am not sure that would solve your problem. 
👀 too see a solution!


artem.alekhin
Level 1 ●
Forum|alt.badge.img+2
  • Author
  • Level 1 ●
  • 10 replies
  • June 17, 2025

@KathyM Previously, the same approach was working, so it seems this issue may be due to a recent change. Is there a setting to disable server-side sanitization for a specific question? Or is there a way to use a comment structure to bypass the sanitization for a specific code snippet?


DRichcreek
Forum|alt.badge.img
  • 4 replies
  • June 17, 2025

The issue could be with the host of the content you’re trying to embed. If the “Feature-Policy” or “Permissions-Policy” HTTP Header is restricting embeds. It would have to be changed on the server where the hosted content is coming from.

I was able to recreate an iFrame with the exact code you provided.

 


artem.alekhin
Level 1 ●
Forum|alt.badge.img+2
  • Author
  • Level 1 ●
  • 10 replies
  • June 17, 2025


@DRichcreek  I think when it comes to camera or microphone access, support is still fairly limited — it's considered experimental in some cases: https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Permissions-Policy/microphone.

Out of curiosity, do you know what Qualtrics plan you're using? I'm starting to suspect that our client might be on a lower-tier plan, which could be why the allow attribute is being stripped.


DRichcreek
Forum|alt.badge.img
  • 4 replies
  • June 17, 2025

@artem.alekhin We’re using XM for Customer Experience - Frontline Digital, but I’ll dig deeper into the permissions to see where there might be a disconnect to see if I can help.


Sachin Nandikol
QPN Level 6 ●●●●●●
Forum|alt.badge.img+44
  • QPN Level 6 ●●●●●●
  • 531 replies
  • June 18, 2025

Hello ​@artem.alekhin

I'm sure you may have already checked this, but I would still recommend verifying whether the "Allow All HTML Markup" and "Allow JavaScript" permissions are enabled for your account. These permissions are essential for embedding iframes with advanced attributes such as allow="microphone".


vgayraud
QPN Level 6 ●●●●●●
Forum|alt.badge.img+58
  • QPN Level 6 ●●●●●●
  • 552 replies
  • June 18, 2025

Hi,

You could try injecting your iframe via javascript instead.


Forum|alt.badge.img+4
  • Level 2 ●●
  • 12 replies
  • June 19, 2025

@artem.alekhin I’ve tried this and its working, please review the below code:

Qualtrics.SurveyEngine.addOnload(function () {
    var iframe = document.createElement('iframe');
    iframe.src = 'https://akashdeep02007.github.io/Qualtrics---Redirect-URL/redirect.html';
    iframe.width = '100%';
    iframe.height = '600px';
    iframe.allow = 'camera; microphone; autoplay';
    iframe.style.border = 'none';
    this.getQuestionContainer().appendChild(iframe);
});

 

Below is a screenshot for the same for your quick reference.

 

 


Forum|alt.badge.img+4
  • Level 2 ●●
  • 12 replies
  • Answer
  • June 19, 2025

Hi ​@artem.alekhin I’ve tried this on my end and it worked. Please review the code below and give it a try.

 

Qualtrics.SurveyEngine.addOnload(function () {
    var iframe = document.createElement('iframe');
    iframe.src = 'https://akashdeep02007.github.io/Qualtrics---Redirect-URL/redirect.html';
    iframe.width = '100%';
    iframe.height = '600px';
    iframe.allow = 'camera; microphone; autoplay';
    iframe.style.border = 'none';
    this.getQuestionContainer().appendChild(iframe);
});