Loading jquery into safari extension

1k views Asked by At

I am unable to load jquery into my safari extensions injected script

Below is my injected script injected.js and the alert is never fired. typeof(jQuery) returns undefined. I even tried adding the script as a "script" node in document.head and nothing is working. My global html file is basically an empty file. I tried some of the suggestion mentioned in the other thread too.

document.addEventListener("mouseup", handleSelectedText, false);

element = document.createElement('bubble');
element.id = 'P';
element.appendChild(document.createElement('googlesearch'));
element.style.display = 'none';
document.body.insertBefore(element, document.body.firstChild); 

if($(document))
{
    alert('js laoded');
}

Below I have added it as a start script, then my injected script is loaded

2

There are 2 answers

2
chulster On

Works for me. Did you remember to grant your extension access to at least some websites? That setting is in the Extension Builder too:

extension website access

0
user2103630 On

Solution was I had to restart the browser after I set the script.