Blocked script execution in 'about:srcdoc' because the document's frame is sandboxed and the 'allow-scripts' permission is not set

Babak Salimi 1 Reputation point
2021-01-28T02:33:30.07+00:00

I have created a HTML page that would be used within the organization only and never access any websites. It is used to recreate MS forms data through power automates which works fine and is not the issue.

I need to be able to run a javascript that would allow users to update the populated html page with new info, the script works fine while testing it on a local pc but gives the mentioned error when it is uploaded to sharepoint online, at which point the script stops working.

the script is not inline and separate from the html code, the allow script has been activated at tenant level, i have also clicked on allow all iframes and the issue persists.

any help would be appreciated at this point since i am at a road block

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,849 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Jerryzy 10,571 Reputation points
    2021-01-28T05:59:10.623+00:00

    Hi @Babak Salimi ,

    If you are using <iframe> tag to reference a html file in SharePoint Online page, try to set sandbox property to "allow-same-origin allow-scripts allow-popups allow-forms" like this:

    61312-snipaste-2021-01-28-13-57-28.png

    blocked-script-execution-in-because-the-documents-frame-is-sandboxed-angular

    Or in SharePoint Online classic experiece, you could also use Script Editor Web Part to inject custom html and JavaScript into the page directly:

    Script Editor Web Part in SharePoint 2016/2013/Online

    Thanks
    Best Regards


    If an Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.