3
votes

I ported an extension from Chrome to Microsoft Edge.The extension works properly in Chrome, but in Edge it has some issues.

One of these issues is that Edge does not support browser.alarms.

For Edge extensions, what are the alternatives to using browser.alarms?

1
"not working" isn't a useful description of the problem, right? You need to debug it, check console for errors in the background page, popup, content script. Also, just changing chrome to browser won't work with callbacks since browser is Promise-based. - wOxxOm
But i am not able to check console for background.js and popup.js . I just can't see those files in the debugger . Can you tell me what all things should i change in my code?I have used browser.tabs.query,browser.extension.getBackgroundPage(),browser.alarms.create and browser.alarms.onAlarm.addListener - Tarun Talreja
See the documentation you've linked. - wOxxOm
Please edit the question to be on-topic: include a minimal reproducible example that duplicates the problem. For Chrome extensions or Firefox WebExtensions this almost always means including your manifest.json and some of the background, content, and/or popup scripts/HTML. Questions seeking debugging help ("why isn't this code working the way I want?") must include: (1) the desired behavior, (2) a specific problem or error and (3) the shortest code necessary to reproduce it in the question itself. Please also see: What topics can I ask about here?, and How to Ask. - Makyen
@Makyen I have edited the question to be on-topic . I have included the things not supported by edge which I was using in chrome extension . So I need to find alternatives for that,which I was not able to do. - Tarun Talreja

1 Answers

1
votes

I did all the research and came to the conclusion that alarms can be replaced simply using the setTimeout function of JavaScript . The function written in browser.alarms.onAlarm.addListener should be written in the 1st parameter of setTimeout() function and currently for clearing the cache programmatically access to browser internal functionality is required which is currently not implemented in Microsoft Edge .