safari-extension

Is it possible to detect the load of an applet?

Hello guys, I'm working on a Safari extension, and I'd like to detect when <applet>s are going to load (the onbeforeload event) on a page. However, there seems to be no such event for these. How should I do it? Transform all <applet> tags to <object> tags and then intercept their onbeforeload events? I think it would break the document...

Safari Extension Questions

I'm in the process of building my first Safari extension--a very simple one--but I've run into a couple of problems. The extension boils down to a single, injected script that attempts to bypass the native feed handler and redirect to an http:// URI. My issues so far are twofold: The "whitelist" isn't working the way I'd expect. Since ...

Safari Extension - How to respond to Settings changes?

Hi, I'm currently working on an Extension for Safari 5 and I want to run a listener function whenever Settings changes are made. Apple provides an example for that, but it doesn't work for me. I currently have this listener function in my global html file: function numberChanged() { if(event.key == "number") alert("Numbe...

Safari extension - Too many injected scripts responding to message

Hi, I am trying to code a safari extension similar to Bubble Translate for Chrome. when you click a button on the toolbar, it automatically translates the text currently selected to the language of your choice using the Google language API. I use the following injected script to get the highlighted text and display the result (as an al...

Safari doesn't detect my Extension Certificate

Hello, all! I have registered for the Safari Development Program and have a valid Apple ID. I've followed all the steps given by Apple. The problem is that Windows XP (Service Pack 2) does not recognize the command 'certreq', whereas the instructions said it would work on any Windows machine. However, the command 'certreq' was working o...

Can I define which characters are allowed to 'break' a word?

Hey guys, I'm showing up veeeery long URLs in my Safari extension. Obviously, they can't fit on a single line. Currently, word breaking rules make it so most URLs are on two lines: the first one is rather short and ends with the ? symbol, and the other is ridiculously long and contains all the rest of the GET parameters. I'd like to ma...

intercepting feed:// in safari5

Hello. I am writing an extension for Safari5 and I am trying to intercept the fact that the user is clicking on an RSS icon and loading a feed://.... URL to offer him/her subscription options. I have tried to register a start content script for the feed:/// whitelist pattern but that does not work. Does anyone know how to make this work?...

Identify link on contextmenu event in safari extension

Hi! I'm trying to build a safari extenstion (mostly for learning purposes) that creates a delicious bookmark, when the user right clicks on a link. I've watched the WWDC Creating a Safari Extension video and everything is working fine. Except that i don't have a clue how to find out if the user clicked on a link (or just some text) an...

Safari 5 Exentsions

I'm trying to teach myself Safari 5 extensions and I'm new to web development in general. Looking at the sample code, I see: <!DOCTYPE HTML> <script> ... </script> I'm just wondering, what language am I looking at? I see functions and code that almost looks C-like. Apple's documentation says it would be helpful to know HTML, javascrip...

HTML PHP JavaScript Whatever to Check Gmail Unread Count

How do all these browser plugins, notifiers, etc. check your gmail unread count? I'm trying to write a Safari Extension (which happens to be in javascript but I don't think it matters) and I can't figure out how to parse the Gmail atom feed (https://mail.google.com/mail/feed/atom) to get the unread count. Thanks, ...

XMLHttpRequest with special characters in Safari Extension does not work

Im trying to make an extension to Safari that authenticates with http://myphotodiary.com's API. And it works well, for all passwords that dont include special characters like: å,ä,ö and space I have the following code working now: var xmlHttp = new XMLHttpRequest(); var url = "https://api.myphotodiary.com/user_status.json?api_ke...

How can you create a local JavaScript database tied to a Safari-5 extension?

I was playing around trying to create a small safari extension, most for the fun of it and to see what you could do etc. Anyways I was thinking about storing some data for my extension in a local database, so I always would have it where I needed it, across page loads. I searched a bit on google and found this snippet from the Safari R...

Javascript XMLHttpRequest Login Promp

I am new to javascript and wrote a simple extension to parse the gmail atom feed and display the number of unread emails. My problem is if for some reason you're not logged into your google account, the extension attempts to check the feed and Safari will display a login box like this. And since I check every 10 seconds these prompts...

Safari Extension, Fluid App

I've written a simple extension for Safari that captures clicks on the RSS button in the address bar (calls to the feed:// protocol) and redirects to Google Reader instead of Safari's feed reader. If, however, the user has a Fluid app (one that opens Google Reader) set as their default feed reader the intercept doesn't work. Is there an...

Safari extension running injected javascript multiple times

So I have copied the code from the following example on the Apple Developer site. http://developer.apple.com/safari/library/documentation/Tools/Conceptual/SafariExtensionGuide/MessagesandProxies/MessagesandProxies.html#//apple_ref/doc/uid/TP40009977-CH14-SW1 When I run the extension, it runs normally except the injected script is run 3...

Suppress Login Prompt from XMLHttpRequest

I am new to javascript but wanted to write a Safari extension to display the badge count of the unread emails in a gmail account. When the user clicks the button it goes to gmail. I got it working and its quite handy. The only thing I can't figure out is how (when the user is not logged into gmail) to suppress my XMLHttpRequest from caus...

What's the UTTypeIdentifier for Safari Extension files? .safariextz

You know, like com.apple.safari.bookmark for Safari Bookmarks, or com.apple.ical.ics for iCal calendars. Thanks. ...

Injection Scripts Executing Multiple Times

I've read the documentation and understand that this is to be expected: Scripts are injected into the top-level page and any children with HTML sources, such as iframes. Do not assume that there is only one instance of your script per browser tab. I'm wondering, though: Other than iframes, what other elements have "HTML sources" ...

Access URLs in the Window's History Object

Is there any way to randomly access the URLs in Javascript's History object in Safari? I'm writing an extension where I need to, on a specifically-formatted page request, capture the URL of the previous page. From what I've been able to find, the History object definition is non-standard across browsers. Safari only seems to expose its l...

Synchronous message passing in a Safari Extension

I'm working on a safari extension and I was wondering if there is a way to do synchronous message passing in a safari extension. I want to send a message from my injected javascript to the global page have the injected javascript wait until a result is returned. Having to split my code into another function that receives a message from ...