Why does Safari intentionally block websocket requests in converted Chrome extensions to safari extensions?

I am converting chrome extensions to safari extension using Xcode's tool xcrun safari-webextention-converter


after successfully building the conversion and running the extension on safari, I am unable to access the websocket requests...


safari intentionally blocks it . why ?


[Warning] [blocked] The page at https://example.com/ requested insecure content from ws://localhost:8081/. This content was blocked and must (extend.iife_dev.js, line 14)


(function() {let __HMR_ID = "0.psbnbvjdf4g";
const LOCAL_RELOAD_SOCKET_PORT = 8081;
const LOCAL_RELOAD_SOCKET_URL = `ws://localhost:${LOCAL_RELOAD_SOCKET_PORT}`;

const DO_UPDATE = 'do_update';
const DONE_UPDATE = 'done_update';

var MessageInterpreter = {
send: (message) => JSON.stringify(message),
receive: (serializedMessage) => JSON.parse(serializedMessage),
};

var initClient = ({ id, onUpdate }) => {
const ws = new WebSocket(LOCAL_RELOAD_SOCKET_URL); <----[blocked the ws://localhost:8081 here]

ws.onopen = () => {
ws.addEventListener('message', event => {
const message = MessageInterpreter.receive(String(event.data));

if (message.type === DO_UPDATE && message.id === id) {
onUpdate();
ws.send(MessageInterpreter.send({ type: DONE_UPDATE }));
}
});
};
};



https://github.com/briehq/brie-extension/issues/172


[Re-Titled by Moderator]

Original Title: [Warning] [blocked] The page at https://example.com/ requested insecure content from ws://localhost:8081/. This content was blocked and must (extend.iife_dev.js, line 14)


Posted on Jun 6, 2025 03:10 AM

Reply

Similar questions

There are no replies.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Why does Safari intentionally block websocket requests in converted Chrome extensions to safari extensions?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.