In addition to what pigubrco said, browser developers consider it dangerous to give Web pages direct access to TCP/IP because that would make it very easy to create botnets. Instead, browsers expose high-level APIs like XHR, WebSocket, and WebRTC and the implementations take care to not be vectors for new attacks.