javascriptgoogle-chrome-extensionwebsocket

Can I wait for a websocket reply before allowing a page to load in a Chrome extension's contentscript?


I'm working on a URL-scanning Chrome extension. In the content script (run at document_start), I send a URL to my websocket server and wait for a returned verdict. However, websocket messages are delivered asynchronously, thus the page may be already loaded and displayed, especially if the network connection is slow.

Can I call websockets in a synchronous way somehow, and allow page loading only after an acceptable response is received?


Solution

  • Per woxxom's comment, it is not possible to use websockets in a synchronous manner.