Posted: July 30th, 2011 | Author: shesek | Filed under: General | Tags: Chrome, chrome extension, desktop notifications, github, github desktop notifications, github notifications, webkit desktop notifications | No Comments »
I’ve been looking for something to notify me about new GitHub notifications, and didn’t find anything. As I also wanted to take a look at the desktop notifications API, I decided to write a small Chrome extension that displays GitHub’s notifications as desktop notifications.
There’s no API or feed to get those notifications from, so I ended up scraping that data from the HTML page using XmlHttpRequest. The options page lets you set the interval for checking for new notifications.
You can browse the source at github.com/shesek/github-notifications, or download the packed extesntion here. Released under WTFPL 2.0.
Posted: December 25th, 2009 | Author: shesek | Filed under: Javascript, Web Development | Tags: Chrome, data URI, Firefox, Opera, Safari | 1 Comment »
I was looking for a way to create a link that won’t send a referrer header at all, for my torrentz.com greasemonkey script (some trackers didn’t like other sites linking directly to their .torrent file), and came up with that (with the help of a Christmas present from anonymous).
It should work on all browsers who supports the data: URI schema with navigable content, which means it won’t work on Internet Explorer 6, 7 (who doesn’t support the data URI at all), 8 (who doesn’t allow navigable content) or old versions of other browsers (one of the great things about writing a Greasemonkey script is that you don’t have to care about any browser other than Firefox). it might work with about: uri on IE6/7, but it wasn’t tested.
Tested on Firefox only, Chrome and Safari.
It works by linking to a data URI that creates a page with some HTML (<html><head><meta http-equiv=”refresh” content=”0;url=http://www.whatismyreferrer.com/”></head></html>) in it:
<a href='data:text/html;charset=utf-8,<html><head><meta http-equiv="refresh" content="0;url=http://www.whatismyreferrer.com/"></head></html>'>Click me</a>
What happens is that you link to a virtual page who redirects to the target URL, so the actual page that made the redirect is the virtual page and not your site (and the browsers doesn’t send the data: URI as the referrer).
Try it in comparison to a regular link
Here’s the function I used to create those links using javascript:
var noreflink=function(href) {
return 'data:text/html;charset=utf-8,'+encodeURIComponent('<html><head><meta http-equiv="refresh" content="0;url='+href.replace('"','"')+'"></head></html>');
}
Also,
document.location=noreflink("http://www.google.com/");
can be used to redirect using javascript without sending a referrer, instead of using a link.
Update: This won’t work on Opera. when using a meta refresh it still uses the URL that linked to the page with the meta refresh as the referrer header. I tried using javscript redirect (document.location) instead, and even with a timer – it doesn’t work.
I did find a working solution for Opera eventually:
does the trick, and the link will look like:
Click me
Try it here
However, that works for Opera only. There’s a way to make a version that’ll work on all browsers (except IE), but because I only needed it for a Greasemonkey script and I don’t care about any browser other than Firefox, I’ll leave that for you. If anyone do write a cross-browser version, add it as a comment and I’ll update the post.