Reinventing the World Wide Web
Content for web pages consists of HTML, JavaScript, CSS. These three technologies have enabled some fantastic content, but they also present massive limitations.
The introduction of WebAssembly has offered some interesting possibilities. The browser has the capability of running virtual machines executing code at near native speed. However the mediator between the browser and the DOM is still JavaScript.
The Proposal
The idea is to rearrange the stack.
The current behaviour for an HTML page is:
- The user selects a URL.
- The browser issues a GET request.
- The browser inspects the Content-Type header and chooses one of the known renderers.
- The page is rendered and the scripts run.
- If WebAssembly is included a virtual machine is started.
The new behaviour would be:
- A WebAssembly virtual machine is started.
- The user selects a URL.
- The browser issues a GET request.
- The browser inspects the headers and based on a new header providing URLs of WebAssembly modules, the browser loads these modules into the virtual machine.
- The modules render the page and the scripts are run.
So rather than WebAssembly being an optional add-on, it becomes the environment in which the page is rendered.
What Now?
The implications of the above are that, the content of a web page could be anything for which a module had been written to handle. Initially there would be a URLs for HTML and JavaScript, for example “https://w3.org/html.wasm”, “https://w3.org/js.wasm”.
Pretty soon I could envisage a Python module, for example “https://python.org/python.wasm”. The “script” tag could now have “type=python”!
The next step would be more interesting. Given that anyone could write a rendering module to replace HTML, anything might happen. Maybe someone would write a YAML version of HTML, or Markdown, or perhaps a 3D page definition language would become popular.
Software vendors would no longer need to write for each OS. The browser would simply use their WebAssembly module, for example a spreadsheet or a CAD/CAM system.
Minor Details ;-)
Current browser implementations have much of the code to implement this proposal. The major change would be in providing a WASM interface for the many web APIs.
Handling of malicious code would be an issue, requiring some kind of verification.
Brave New World
What I like most about this idea, is that I have no idea where it would take us; and that’s the point. We would be free of the gilded cage and only limited by our imagination.