Lock Cursor to Screen resolution

The Main Question is i am building a Web Player Game and have a custom mouse pointer and want to be able to keep it Infect depend on it. The Q i have is how would i set the mouse to be bound by the screens resolution 800x600 so the cursor can’t go past the sides of the web player. Maybe only if the player presses escape cause it would be annoying if you can’t get your cursor back.

I have tried Screen.lockCursor = true; but doesnt give me the effect i want.

Thanks in advance guys!!

a simple mouse lock should do this