It seems that you have a WebGL version 1 (OpenGL ES 2.0) and that's why it does not accept OpenGL ES 3.x features.
Review the code where you request the context for WebGL
var gl = canvas.getContext("webgl2"); // 2!
var gl = canvas.getContext("webgl2"); // 2!
If you are requesting webgl2WebGL2, check that there isare no spaces or lineswhitespaces before "#version 300 es"#version 300 es.
You can find additional guidance https://webgl2fundamentals.org/webgl/lessons/webgl-fundamentals.htmlhere.