I am writing a Safari Extension, to create a duplicate of tab
This is following code i have written so far
safari.application.addEventListener("command", commandHandler, false);
function commandHandler(event) {
console.log("Command Handler");
if (event.command = "duplicate") {
var url = safari.application.activeBrowserWindow.activeTab.url;
console.log("Url " + url);
console.log(safari.application.activeBrowserWindow.activeTab);
safari.application.activeBrowserWindow.openTab().url = url;
}
}
and my url is undefined, what is that i am missing.
As suggested above, you might need to change the "Extension Website Access." If you choose "All," you shouldn't need to worry about whitelists/blacklists. If you choose "Some," you must add items to the whitelist otherwise your extension won't be able to access the current page.
If this doesn't appear to work, you might need to restart your browser for the Access settings to kick in... I was having issues with HTTPS pages.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With