I am trying to use WebSocket in a call to page.evaulate() in PhantomJS (2.1.1). When trying to connect to the WebSocket server, the following error occurs:
SecurityError: DOM Exception 18: An attempt was made to break through the security policy of the user agent.
I managed to disable CSP in Firefox by going to about:config and setting security.csp.enable to false. After that, I can run the same code with the PhantomJS script, without any problems pasting it into the console in Firefox.
Can I disable the content security policy in PhantomJS? (I tried setting page.webSecurityEnabled = false and page.localToRemoteUrlAccessEnabled = true no avail.)
source share