I very much understand your frustration. Hate JS web page as well, but this kinda game multipage logic type of thing SPA is better. Just wish I can only give authorization to certain JS api.
This is already implemented in any browser I know, but for some reason it is available only to some functionality (microphone, camera etc.) but not for eg. Ajax, Cross-Origin Things, Websockets, Canvas2D, WebGL etc.
Also before executing any Javascript browsers should ask if you want this website to execute (potentially malicious) code on your computer!
There are many documented browser-exploits and basically all newer ones that are actually a danger to users involve Javascript. It's also not reasonable to assume that people only visit trusted sites.