Center Mouse On MOUSE_MODE_CAPTURED

Godot Version

4.3

Question

In my fps game test, when I use -

Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)

In editor it works fine. But when I run the game in browser the mouse does not center itself. The raycast follows where I click the mouse to capture it.
On escape key pressed I am using -

Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)

And on left mouse click I am capturing the mouse using above code. But mouse does not center. It stays where I click to capture it.
How to make mouse center on MOUSE_MODE_CAPTURED?