This is for a Chrome extension.
The following docs have been taking into account: Chrome Notification API
The following 3 files for example of problem:
Manifest:
{
"name": "Title",
"description": "desc",
"version": "1.1",
"manifest_version": 3,
"background": {
"service_worker": "bg_page.js"
},
"permissions": ["notifications"],
"content_scripts": [
{
"matches": [
"<all_urls>"
],
"js": ["contents.js"]
}
]
}
content.js
// content.js
tld = 'com';
var url = 'https://stackoverflow.com';
console.log(url);
chrome.runtime.sendMessage({
action: 'xhttp',
url: url,
tld: tld
}, function(responseText) {
console.log(responseText);
//handleCallback(responseText);
//console.log(responseText);
/*Callback function to deal with the response*/
});
bg_page.js
chrome.runtime.onMessage.addListener(function(request, sender, callback) {
var name = 'test' + (Math.floor(Math.random() * 10000)).toString() + 'v5';
chrome.notifications.create(name, {
type: 'basic',
iconUrl: 'https://i.picsum.photos/id/919/536/354.jpg?hmac=NQVTG38LLhSmuQu5ztuZ846sqRtDy4nzwI-1C457j-o',
title: 'Test',
message: 'Current Name: ' + name,
priority: 2,
}
);
console.log('test');
console.log(name);
return true;
});
The above works in Chrome on Windows, but not on Mac with version 95 of chrome (and possibly others as well).
So my question is:
Why does this not work on Mac with new versions of Chrome?
The Extention should show a Desktop notification everytime a site is visited in this test case.
Note: Has been tested on 3 seperate Macs.
It might also not work on older versions, has not been tested, but im only focussing on newer versions/newest version of Chrome.
The following has been tested and discussed:
- Permission issue between Chrome and Mac - has been tested on 3 different Macs, all with same result, and not working.
- Permission issue between Chrome and Site - but since it should work on all sites in the test code above, this shouldn't be the case. Has also been tested and confirmed, and problem still exists.
So im out of ideas.