Connect to socket via JavaScript (no flash)

I have a browser-based application that needs to communicate with another service running on the client machine through a socket connection from a browser using JavaScript.

I need to send and parse XML back and forth on a socket.

I can not go down the path of flash memory, because the protection of cross-domain security is a barrier, i.e. a socket service cannot be modified to support Flash cross-access security.

What are my options for a clean JS based solution?

+3
source share
4 answers

Here you have two main problems:

  • In javascript, it's hard to access resources without HTTP,
  • javascript , .

, . :

  • - - , XML -.

  • , , XML http- JSONP, , script script, URL- , .

  • "", HTTP-, , - Access-Control-Allow-Origin HTTP, do , XMLHttpRequests .

+1

Javascript . . - /swf , file:///, localhost (, ).

0

, - . - , .

0

, . : Flash, Java Silverlight. , Java, , .

, . , , Ajax . , .

0

Source: https://habr.com/ru/post/1735127/


All Articles