I create a safari extension , but I don’t kown how to add javascript code to safari extension?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
A Safari extension is almost entirely Javascript. That’s a bit of an oversimplification, but what kind of extension have you created if there’s no Javascript? You can write as much or as little JS as you like in any injected script or in a global HTML file. The details of where/when/how to use each of these is pretty well documented.
There’s nothing particularly special about the nature of the Javascript that you can place in any of these files except that you do have access to a Safari-centric API. Otherwise, it’s just the same old Javascript you’d write for the web with a few quirks of the framework itself. A lot of folks even include jQuery or other JS libraries to help, though they add more overhead than I’d recommend in most cases.