Safari Extension safari.application error

I'm making an extension for safari I created a context item with command = showNote

In debugger I get the follwing error TypeError: Result of expression 'safari.application' [undefined] is not an object on line 8(the last line)

are there any things you need to include or call before this works?


function showNote(event){
    if(event.command == "showNote"){
        addElement = document.createElement('<div id="safExtNote"><textarea id="safExtNoteText"></textarea><button id="safExtSave">Save</safExtNote></div>');
        alert("im online");
safari.application.addEventListener("command", showNote, false);



Just ran into this problem myself trying to create a toolbar command. Turns out I was putting the JS in the wrong place. I added it to the "Injected Extension Content" as a start script. Needed to create an HTML page that included the JS and set that as the Global Page File.

Switch that around and you should be set, assuming it's the same problem I just ran into.


Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.