blockly & cross origin headers

190 views
Skip to first unread message

rd

unread,
Feb 2, 2022, 6:45:30 AM2/2/22
to Blockly
hello list,

i have a blockly program that needs to access a shared array, and so needs to run with Cross-Origin-*-Policy headers set (to require-corp and same-origin)

when i do this, using an unmodified current checkout of the blockly git archive, i get

 net::ERR_BLOCKED_BY_RESPONSE.NotSameOriginAfterDefaultedToSameOriginByCoep 200|206

for the following files:

 GET https://blockly-demo.appspot.com/static/media/disconnect.wav
 GET https://blockly-demo.appspot.com/static/media/sprites.png
 GET https://blockly-demo.appspot.com/static/media/delete.mp3
 GET https://blockly-demo.appspot.com/static/media/click.mp3

the missing sounds are not so bad, but the missing images in the workspace would be nice to have!

what is the suggested way to run blockly with the cross-origin headers set?

thanks in advance,
(blockly is wonderful!)
rohan

Neil Fraser

unread,
Feb 2, 2022, 11:25:39 AM2/2/22
to blo...@googlegroups.com
When you inject Blockly, you just need to set the path to your local media directory rather than the default over on appspot.

Here are the docs:

> media
> string
> Path from page (or frame) to the Blockly media directory. Defaults to "https://blockly-demo.appspot.com/static/media/".



--
You received this message because you are subscribed to the Google Groups "Blockly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blockly+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/blockly/01b752dd-b5a2-4a20-b955-fdfb574a1902n%40googlegroups.com.


--

Rohan Drape

unread,
Feb 2, 2022, 4:15:22 PM2/2/22
to blo...@googlegroups.com
hello neil,

thanks kindly, that's perfect, so simple! (and sorry i missed it, the instructions are very clear...)
thanks,
rohan

ps. searching "https://blockly-demo.appspot.com/static/media/" doesn't find that page, but without the quote marks it does! (and then also finds earlier questions about this, apologies for duplicate...)

Rohan Drape

unread,
Feb 2, 2022, 4:32:58 PM2/2/22
to blo...@googlegroups.com
hello list,

the thread at <https://groups.google.com/g/blockly/c/vlVCDXFjvOc> adds a "sounds: false" option to the config

it works perfectly, but it's not mentioned at <https://developers.google.com/blockly/guides/configure/web/configuration_struct> anymore

is this still the correct way to turn sounds off?

best,
rohan

Maribeth Bottorff

unread,
Feb 2, 2022, 8:49:03 PM2/2/22
to Blockly
I believe so. Not sure why it's not in the documentation, but it's in the options struct in code and there's also an option for it in the advanced playground: https://blockly-demo.appspot.com/static/tests/playgrounds/advanced_playground.html#renderer=geras&sounds=false&theme=zelos so I don't know why it wouldn't be supported. I'll check with the team and add it to that page, thanks for bringing this up!

Maribeth Bottorff

unread,
Feb 3, 2022, 4:01:44 PM2/3/22
to Blockly
Just added this to the options struct documentation, thanks again for mentioning that.

Maribeth

Rohan Drape

unread,
Feb 3, 2022, 7:37:23 PM2/3/22
to blo...@googlegroups.com
Excellent, thanks very kindly!  Best, Rohan

Reply all
Reply to author
Forward
0 new messages