Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

safari.application.activeBrowserWindow.activeTab.url is undefined

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.


1 Answers

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.

like image 72
lepolt Avatar answered Nov 24 '25 05:11

lepolt