I did some research to find a solution and came across this thread. Basically, it suggests adding the following lines in your shader:
#if !UNITY_REVERSED_Z
depth = 1.0f - depth;
#endif.
That should fix the problem.
https://discussions.unity.com/t/depth-texture-not-working-correctly-on-webgl/149...