- Posts: 19
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Content-Security-Policy Issue
- davidg1982
- Topic Author
- Offline
- New Member
Less
More
5 years 10 months ago #172673
by davidg1982
Content-Security-Policy Issue was created by davidg1982
I am trying to implement an iframe for respondents to Speed Test their Internet connection into my survey for a broadband survey, however I am getting this error. I don't know how to edit the Content-Security-Policy because I do not know where it is located.
Can you help me resolve this?
Thanks!
Code:
Content Security Policy: The report URI (about:blank) should be an HTTP or HTTPS URI. Content Security Policy: The page’s settings observed the loading of a resource at https://openspeedtest.com/service-worker.js (“worker-src”). A CSP report is being sent.
Can you help me resolve this?
Thanks!
The topic has been locked.
- jelo
- Offline
- Platinum Member
Less
More
- Posts: 5038
- Thank you received: 1260
5 years 10 months ago #172675
by jelo
The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
Replied by jelo on topic Content-Security-Policy Issue
What version of LimeSurvey is used?
There are a few ways how that blocking can be caused.
First check. Settings -> Security -> IFrame
There are a few ways how that blocking can be caused.
First check. Settings -> Security -> IFrame
The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
Attachments:
The topic has been locked.
- davidg1982
- Topic Author
- Offline
- New Member
Less
More
- Posts: 19
- Thank you received: 0
5 years 10 months ago #172676
by davidg1982
Replied by davidg1982 on topic Content-Security-Policy Issue
The topic has been locked.
- jelo
- Offline
- Platinum Member
Less
More
- Posts: 5038
- Thank you received: 1260
5 years 10 months ago #172678
by jelo
The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
Replied by jelo on topic Content-Security-Policy Issue
Can you provide the iframe html code? Best thing would be to create a small survey with just the embedding and attach the export here.
And check it with a browser without any extension.
The error "Content Security Policy: The report URI (about:blank) should be an HTTP or HTTPS URI." is typical for issues with extensions (e.g. ones that block external scripts.)
And check it with a browser without any extension.
The error "Content Security Policy: The report URI (about:blank) should be an HTTP or HTTPS URI." is typical for issues with extensions (e.g. ones that block external scripts.)
The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The topic has been locked.
- davidg1982
- Topic Author
- Offline
- New Member
Less
More
- Posts: 19
- Thank you received: 0
5 years 10 months ago #172680
by davidg1982
Replied by davidg1982 on topic Content-Security-Policy Issue
I am not sure what I did, but the iframe works now.
My next step is to get the iframe into an JS+JQuery code as a button, I cannot get it working.
It works on codepen.io/davidg1982/pen/yxBqOGCodePen , but not on the survey. It gives no errors either.
My next step is to get the iframe into an JS+JQuery code as a button, I cannot get it working.
Code:
<script type="text/javascript">jQuery(document).ready(function($){ $('#button').click(function(){ if(!$('#iframe').length) { $('#iframeHolder').html('<iframe id="iframe" src="https://openspeedtest.com/Get-widget.php" width="700" height="450"></iframe>'); } }); }); </script> <button id="button">Speed Test Here</button> <div id="iframeHolder"></div>
It works on codepen.io/davidg1982/pen/yxBqOGCodePen , but not on the survey. It gives no errors either.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10148
- Thank you received: 3607
5 years 10 months ago #172705
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Content-Security-Policy Issue
You need to add a type="button" attribute to the button or it will try to submit the form.
To avoid iframe loading-lag, I would load the iframe in a hidden container as soon as the page loads and then simply show the container with the button.
To avoid iframe loading-lag, I would load the iframe in a hidden container as soon as the page loads and then simply show the container with the button.
Code:
<script type="text/javascript"> $(document).on('ready pjax:scriptcomplete',function(){ var buttonText1 = 'Speed Test Here'; var buttonText2 = 'Hide Speed Test'; $('#speedTestButton').click(function(){ if(!$('#iframeHolder').is(':visible')) { $('#iframeHolder').fadeIn(300, function(e) { $('#speedTestButton').text(buttonText2); }); } else { $('#iframeHolder').fadeOut(300, function(e) { $('#speedTestButton').text(buttonText1); }); } }); }); </script> <button id="speedTestButton" type="button">Speed Test Here</button> <div id="iframeHolder" style="display: none;"> <iframe id="iframe" src="https://openspeedtest.com/Get-widget.php" width="700" height="450"></iframe> </div>
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: davidg1982
The topic has been locked.
- davidg1982
- Topic Author
- Offline
- New Member
Less
More
- Posts: 19
- Thank you received: 0
5 years 10 months ago #172722
by davidg1982
Replied by davidg1982 on topic Content-Security-Policy Issue
That totally worked. Thanks!
The topic has been locked.