dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.42k stars 10k forks source link

WASM PreLoader #29694

Closed Pinox closed 3 years ago

Pinox commented 3 years ago

Hi Guys,

It would be really nice if Microsoft can create a Chromium extension that can be used in Edge and Chrome that can prefetch any WASM Website / files when the browser starts. (especially Blazor WASM files including the Mono runtime.) From a user perspective this is a opt in feature and the extension can also be used on other WASM web files , so it's not Blazor specific.

A very simple extension where you add a Json or XML file that defines the retrieval parameters of the files that needs to be prefetched with some logic when the extension gets executed when the browser starts.

eg

`<?xml version="1.0" encoding="UTF-8"?>

12h 1.1 mono.dll newtonsoft.dll blazorapp.dll ` ![WASM](https://user-images.githubusercontent.com/5297255/106043094-9bf1ed00-60e6-11eb-9e1c-631f95f61be8.png) This can significantly reduce the Blazor WebAssembly loading times that I think will be a great addition to all the current efforts by the Blazor team to reduce the initial load of web assembly files. So when you open your browser for the first time, then this extension gets executed and by the time the user hits your wasm website all is ready to go. Most users are very comfortable with using extensions on browsers for specific features like "Ad blocker" so no reason we can't add a browser extension for "instant loading" of wasm websites as an optional extra to those that prefer it. (especially in a corporate / enterprise environment) In keeping the extension generic it can also be used by "other" wasm implementations that have the same problem of file download sizes so it's good for all WASM implementations out there.
javiercn commented 3 years ago

@Pinox thanks for contacting us.

It is very unlikely that we go in this direction.

While we appreciate the suggestion, for the reasons stated above we don't think this is a direction we plan to go.

Hope this helps.

Pinox commented 3 years ago

thanks @javiercn I respect your feedback but don't agree at all.

We aim to offer a good experience without requiring users to install any plugin since that defeats the purpose of being a web framework.

I predicted this feedback as you might see this as a "Silverlight" plugin , but I think the web has moved on from then. As said it's an extra and not a requirement to run Blazor apps.

You can configure Edge to open a set of pages on startup in edge://settings which will produce the same result without requiring a plugin

This is not the same as it actually opens the wasm website (irritation factor for user can be huge as he does not always want to open your site) , whereas a extension will download the files on a background thread out of view from the end user.

We don't think we can do this in a general way nor that many people would spend the time into configuring a file to make their site download a bit faster on the first visit.

It's way more work to configure a WASM prerendered solution (server side) that switches to client side once downloaded, also forces you to run extra architecture (server) on the backend.

You can use a PWA to support offline scenarios and "instant" resume

Then why have wasm prerendered solutions at all that switches to webasembly mode once downloaded when we can just use PWA's. PWA's only work great if the downloaded files don't change otherwise it's exactly the same problem. (files needs to download)

An extension is an easy and inexpensive way to get a great user experience without irritating end users with "loading times" that exist in PWA's when the underlying files change or setting up loaded "websites" in the browser that the user wont need every time on browser startup.

javiercn commented 3 years ago

I predicted this feedback as you might see this as a "Silverlight" plugin , but I think the web has moved on from then. As said it's an extra and not a requirement to run Blazor apps.

As you mention is an extra and if you or someone else wants to go ahead and build something like this for their apps/company that is fine on our view, but we don't think we should be the ones providing it nor that it is a good idea in the general case, since it creates a separate experience for customers who have the plugin installed and customers who don't.

This is not the same as it actually opens the wasm website (irritation factor for user can be huge as he does not always want to open your site) , whereas a extension will download the files on a background thread out of view from the end user.

If a company/org is adamant on doing this they can probably do it through a script that does it in the background, with a headless browser that kills after the pages have been loaded without disturbing the user.

It's way more work to configure a WASM prerendered solution (server side) that switches to client side once downloaded, also forces you to run extra architecture (server) on the backend.

But the work is on the developer, 1 time for their app, not on the customer configuring an XML/JSON so their site loads faster.

Then why have wasm prerendered solutions at all that switches to webasembly mode once downloaded when we can just use PWA's. PWA's only work great if the downloaded files don't change otherwise it's exactly the same problem. (files needs to download)

Because prerendering is about delivering content faster to the user while the assets get ready/the apps starts. PWAs are about providing a faster startup experience for recurring visit via caching of static assets and offline support.

PWA's only work great if the downloaded files don't change otherwise it's exactly the same problem. (files needs to download)

This is not the case, PWAs can use the existing files while the new version of the app is downloaded in the background and the next time the user visits the page will start with the updated experience.


I understand that this might not be what you want to hear, but ultimately we don't think this is something we want to promote as it creates separate user experiences, it is a non trivial amount of work to create and maintain, and we think there is other work on the platform that has a higher priority than this.

Pinox commented 3 years ago

@javiercn

go ahead and build something like this for their apps/company that is fine on our view

If it's not worth the investment for MS then no company will do this for one website.

But the work is on the developer, 1 time for their app, not on the customer configuring an XML/JSON so their site loads faster

If you look at the example I provided , the end user will only enter the website url . the end user will not enter a json or xml file. The developer will include this in the root directory of the website as he also wants to control the version number as an example, The chromium extension will automatically look for this specific file (xml /json) in the root directory.

PWAs are about providing a faster startup experience for recurring visit via caching of static assets and offline support.

Agree , but PWA's makes a bad candidate for constantly changing source files especially on API level so it's not perfect either.

I understand and agree with the fragmentation issue 100%. As an developer all I want is options. Thanks for the discussion.

On a different note why do the Blazor team not promote "User Challenges" where you can encourage the community to create specific solutions for specific problems. Putting prizes on such challenges works great and also give developers exposure. Just look at the Xamarin team with their "UI Challenges" These challenges increase the online visibility and examples greatly and is hugely beneficial to the community.

I can think of a couple of competitions that Blazor can have:

1) Blazor UI challenge, Working prototype of existing website page clone using blazor.
2) Top 10 Javascript packages implemented in Blazor (working prototype) 3) Data analysis (charts etc) using Blazor or JS packages, 4) Best animation website page in blazor.

The list can go on , it only cost you a small amount of time and effort for someone at MS to manage the process and I'm sure a prize or 2 is something one of the biggest companies in the world can afford ;))

ghost commented 3 years ago

This issue has been resolved and has not had any activity for 1 day. It will be closed for housekeeping purposes.

See our Issue Management Policies for more information.