web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

Realtime Preference Center - Javascript Blocked

(1) ShareShare
ReportReport
Posted on by 14
Hello,
 
I am trying to add Javascript to Preference Center but it keeps being blocked because of a missing allow-scripts in the iframe.
Of course, the editor iframe does have the allow-scripts option.
 
Error:
 
Code:
I have the same question (0)
  • Suggested answer
    Saif Ali Sabri Profile Picture
    2,351 Super User 2025 Season 2 on at
    The error occurs because the iframe in which the Preference Center loads is sandboxed without the allow-scripts permission, preventing JavaScript execution.

    Solution:

    1. Check the iframe configuration
      Ensure that the iframe embedding the Preference Center includes the allow-scripts attribute:
    html 
    <iframe src="your-preference-center-url" sandbox="allow-scripts allow-same-origin"></iframe>
    If the sandbox attribute is present but does not include allow-scripts, JavaScript will be blocked.
    1. Modify the embedding page (if possible)
      If you control the page embedding the Preference Center, update its iframe settings to allow scripts.
    2. Check Content Security Policy (CSP)
      Ensure your CSP settings in the header allow script execution:
    html 
    Content-Security-Policy: script-src 'self' 'unsafe-inline' 'unsafe-eval' https://your-allowed-scripts.com;
    1. If using a third-party tool (e.g., Dynamics 365)
      • Check if the Preference Center provider allows script execution inside iframes.
      • If the iframe settings are controlled by a platform like Dynamics 365 Marketing, you might need to use alternative methods like custom event handlers or API calls instead of inline scripts.
    If the issue persists and you cannot modify the iframe, consider embedding the script outside the Preference Center iframe (on the parent page). Let me know if you need more details!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 70 Super User 2025 Season 2

#2
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 33 Most Valuable Professional

#3
Daniyal Khaleel Profile Picture

Daniyal Khaleel 32 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans