0

I have done the global page file as

<script>  
safari.application.addEventListener("command", performCommand, false);  

function performCommand(event) {   
    if (event.command == "open-nettuts") {      
$('div.spaceball').hide();
    }  
}  
</script>  

And in the start scripts I have put a jquery.js file. Why when I click on the toolbar button does it not hide the div with the class="space ball" on this page?

enter image description here

maxisme
  • 3,974
  • 9
  • 47
  • 97

1 Answers1

0

You can't access to web content, but you can inject js to page, wich modify something. See Safari Extensions Development Guide page 16.

To work on web content write in inject.js

var script   = document.createElement("script");
script.type  = "text/javascript";
//script.src   = "path/to/your/javascript.js";    // use this for linked script
script.text  = "alert('voila!');"               // use this for inline script
document.body.appendChild(script);

See Can't append element.

Community
  • 1
  • 1