I'm trying to convert an existing Chrome Extension to Safari Web Extension using this converter.
Immediately after convert, xcode opens and I build the project with my developer certificate. Everything looks perfect in Safari: the popup works fine, the context menu item is there, options are there.
The moment I restart Safari OR rebuild the project (even without changes), the context menu item disappears.
This is how context menu is defined in my context.js script:
My manifest.json has this:
I followed these instructions and added this key to info.plist in the folder "ProjectName Extension":
After rebuilding the project, nothing changed.
Any ideas how to make context menu consistent?
Immediately after convert, xcode opens and I build the project with my developer certificate. Everything looks perfect in Safari: the popup works fine, the context menu item is there, options are there.
The moment I restart Safari OR rebuild the project (even without changes), the context menu item disappears.
This is how context menu is defined in my context.js script:
Code Block javascript chrome.runtime.onInstalled.addListener(function() { chrome.contextMenus.create({ "title": chrome.i18n.getMessage("contextMenu"), "contexts": ["selection"], "id": "context" + "selection" }); }); chrome.contextMenus.onClicked.addListener(onClickHandler);
My manifest.json has this:
Code Block json "permissions": ["activeTab", "storage", "contextMenus"],
I followed these instructions and added this key to info.plist in the folder "ProjectName Extension":
Code Block language <key>SFSafariContextMenu</key> <array> <dict> <key>Text</key> <string>Context Menu Text</string> <key>Command</key> <string>commandMenu</string> </dict> </array>
After rebuilding the project, nothing changed.
Any ideas how to make context menu consistent?
Apparently there is a bug that context menus are not persisted between loads / launches.
So I deleted this part:
and with just this it works fine:
So I deleted this part:
Code Block javascript chrome.runtime.onInstalled.addListener(function() {
and with just this it works fine:
Code Block javascript chrome.contextMenus.create({ "title": chrome.i18n.getMessage("contextMenu"), "contexts": ["selection"], "id": "selection" });