I am trying to use a Flash object stored in a blob, however my approach using the URL returned by URL.createObjectURL as the src of the embed tag just results in the browser downloading the blob as a file.

Here's my generated HTML:

<object height="500" width="1000">
    <embed height="500" width="1000" src="blob:http://127.0.0.1:34721/1fa7a01c-25b7-4ad0-ba1d-1ddef61617ce"/>
</object>

And here's JavaScript used to generate the Blob and object tag:

var blob = new Blob(data, {
               type: 'application/x-shockwave-flash'
           });

document.body.innerHTML += '<object height="500" width="1000" ><embed height="500" width="1000" src="' + URL.createObjectURL(blob) + '"/></object>'

Where data is an array of Uint8Arrays, each containing 256 bytes of the binary data.

The blob in question has a type of application/x-shockwave-flash and is identical to the original .swf file (I checked). The file itself works when used in place of the Object URL.

From what I have read, an Object URL pointing to a blob can be used any place a normal URL could. Are embed tags an exception to this?

0
DividedByZero 15 November 2017, 18:24

1 menjawab

Jawaban Terbaik

Tag sematan mungkin kehilangan tipe pantomim yang biasanya didapat dari header respons. Coba atur "type="application/x-shockwave-flash" sebagai atribut di dalam tag semat Anda.

Still, Flash isn't widely supported anymore, I'd test across browsers to see if it's the same error. You may need to add the type to the object tag in legacy browsers.

2
Radio 15 November 2017, 17:04