Access-Control-Allow-Origin’ even after installing extension

Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.

Making a phone call app with Angular and install it as an Chrome extention

Pretty complicated right ?

I know its trivial to call a phone from a Ionic application, but I wonder if we can do the same thing in a Angular application installed on Chrome as an extention.

The reason says it wont work at least on desktop Chrome, as it doesnt have native support and functionality. It may work on mobile Chrome as we are on mobiles.

But I wonder if someone has tried something like that, and if yes, I would love to hear more details.

Thanks

chrome.sockets.udp how successful broadcast exampple

I’m attempting to build an Ionic app that would interact with other apps on the same wifi network. So, I’m looking to chrome.sockets.udp to establish some way to send messages between them. Below is my first attempt as sending a message to all devices on the same network – although this example is just on one host. I have both setBroadcast and setMulticastLoopbackMode set to true, but a message is never received in one of the listeners. Why not?

let chrome = window['chrome'];

chrome.sockets.udp.onReceiveError.addListener((data) => {
    console.log('received error');
    console.log(data);
});

chrome.sockets.udp.onReceive.addListener((data) => {
    console.log('received');
    console.log(data);
});

chrome.sockets.udp.create({}, (socketInfo) => {
    // The socket is created, now we can send some data

    var socketId = socketInfo.socketId;
    console.log(socketId);

chrome.sockets.udp.setBroadcast(socketId, true, (response_code) => {
        console.log('broadcast: ' + response_code);
        chrome.sockets.udp.setMulticastLoopbackMode(socketId, true, (loopback_code) => {
            console.log('loopback code: ' + loopback_code);
            chrome.sockets.udp.bind(socketId, '0.0.0.0', 0, (bind_code) => {
                console.log('bind: ' + bind_code);
                chrome.sockets.udp.send(socketId, str2ab('123'), '255.255.255.0', 10090, (sendInfo) => {
                    console.log("sent " + sendInfo.bytesSent);
                    console.log("sent_code " + sendInfo.resultCode);
                });
            });
        });
    });
});

Output:

[17:49:30]  console.log: 2
[17:49:30]  console.log: broadcast: 0
[17:49:30]  console.log: loopback code: 0
[17:49:30]  console.log: bind: 0
[17:49:30]  console.log: sent 6
[17:49:30]  console.log: sent_code 0

chrome.sockets.udp how to successfully broadcast?

I’m attempting to build an Ionic app that would interact with other apps on the same wifi network. So, I’m looking to chrome.sockets.udp to establish some way to send messages between them. Below is my first attempt as sending a message to all devices on the same network – although this example is just on one host. I have both setBroadcast and setMulticastLoopbackMode set to true, but a message is never received in one of the listeners. Why not?

let chrome = window['chrome'];

chrome.sockets.udp.onReceiveError.addListener((data) => {
    console.log('received error');
    console.log(data);
});

chrome.sockets.udp.onReceive.addListener((data) => {
    console.log('received');
    console.log(data);
});

chrome.sockets.udp.create({}, (socketInfo) => {
    // The socket is created, now we can send some data

    var socketId = socketInfo.socketId;
    console.log(socketId);

chrome.sockets.udp.setBroadcast(socketId, true, (response_code) => {
        console.log('broadcast: ' + response_code);
        chrome.sockets.udp.setMulticastLoopbackMode(socketId, true, (loopback_code) => {
            console.log('loopback code: ' + loopback_code);
            chrome.sockets.udp.bind(socketId, '0.0.0.0', 0, (bind_code) => {
                console.log('bind: ' + bind_code);
                chrome.sockets.udp.send(socketId, str2ab('123'), '255.255.255.0', 10090, (sendInfo) => {
                    console.log("sent " + sendInfo.bytesSent);
                    console.log("sent_code " + sendInfo.resultCode);
                });
            });
        });
    });
});

Output:

[17:49:30]  console.log: 2
[17:49:30]  console.log: broadcast: 0
[17:49:30]  console.log: loopback code: 0
[17:49:30]  console.log: bind: 0
[17:49:30]  console.log: sent 6
[17:49:30]  console.log: sent_code 0