Skip to content

Commit 43abeeb

Browse files
committed
use protocol-relative URL. Fixes #42.
1 parent 9ee6c9d commit 43abeeb

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

static/index.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ function selectText(containerid) {
1212
}
1313

1414
$(function() {
15-
var FORCE_HTTPS = true;
15+
var FORCE_HTTPS = false;
16+
var FORCE_PROTOCOL_RELATIVE = true;
1617
var widgetURL = p5Widget.url;
1718
var simplifyHtml = function(html) {
1819
// This will convert e.g. data-autoplay="", which is how browsers
@@ -23,6 +24,8 @@ $(function() {
2324

2425
if (FORCE_HTTPS) {
2526
widgetURL = widgetURL.replace('http:', 'https:');
27+
} else if (FORCE_PROTOCOL_RELATIVE) {
28+
widgetURL = widgetURL.replace(/^https?:/, '');
2629
}
2730

2831
$("#script-tag-example").text('<script src="' + widgetURL + '"></script>');

0 commit comments

Comments
 (0)