node.js - Why can HTML opened with file protocol connect to websocket?
迷茫
迷茫 2017-05-16 13:39:14
0
2
655

The server is built with Nodejs, and the client is opened in Google Chrome using the file protocol, and the data can be successfully connected and returned.

迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

reply all(2)
世界只因有你

The browser does not require that the page and the URL of the wss connection have the same origin (if necessary, you can still check the Origin on the server and reject such a connection)

洪涛

It is true that Websocket is over HTTP, but it does not mean that it must be over HTTP for the page you get. When you open the file, js executes the connection and creates a new tcp connection for handshake.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!