Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

Blazor Wasm fails to register as shared content target

$
0
0

I created a new Blazor WebAssembly Standalone App and added next code to the manifest so it gets registered as a shared content target for csv files:

"share_target": {"action": "/store-code-snippet","method": "POST","enctype": "multipart/form-data","params": {"title": "name","text": "description","url": "link","files": [      {"name": "pdfFile","accept": [ "text/csv", ".csv" ]      }    ]  }}

I also replaced the code on service-worker.js by next one:

self.addEventListener('fetch', event => {    const url = new URL(event.request.url);    if (event.request.method === 'POST'&& url.pathname === '/store-code-snippet') {        event.respondWith((async () => {            const data = await event.request.formData();            const filename = data.get('title');            const file = data.get('textFile');            const reader = new FileReader();            reader.onload = function (e) {                const textContent = e.target.result;                // Do something with the textContent here.            };            reader.readAsText(file);            return Response.redirect('/snippet-stored-success', 303);        })());    }});

Then I published it, run it on a Windows PC Google Chrome browser and install it successfully.But when I rightclick a .csv file and select "share" I can't see my wasm among the target apps.Did I forget anything?


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>