JavaScript

HOWTO: Stop a window.opener() hijacker

On a current project, we have links to another online application. The login page of this app has javascript to ensure that should a site link to it using target='_blank' or any other method of window opening, then it will instead 'hijack' the parent window and close the blank one.

I'm sure that made sense to the developers at the time, but if you're trying to link in an action (eg confirming an event booking) from your own scheduling application, you don't want the event you're editing getting wiped out because some other website says so.

"Error: urchinTracker not defined" fix for Google Analytics urchin.js

I've been very impressed by Google Analytics, but I noticed an error appearing in FireFox browsers. While apparently harmless, it makes it hard to debug your JavaScript if something else is shouting for attention :)

So, I replaced the reference to Google's urchin.js with a fixed version (thanks to Caleb who provided the modified routine). You are welcome to copy this to your own site and use it there.

Paperfish goes live

Paperfish's new website is live this evening! I'm quite stoked with it. The design is a fairly simple template which uses a series of gentle water images in the header, and they crossfade nicely using some very sexy Javascript and CSS manipulation.

I threw this together using the YUI toolkit and a lot of fooling around to get it to behave right. I think the overlaid images are still a single pixel out (to the right), but the effect is lovely.

dynamically loading JS files from JS

wow, this rocks ... dynamically load a remote JS file and have it be useable ... cool!

var s = document.createElement('script');
s.type = 'text/javascript';
s.src = '/scripts/library.js';
document.getElementsByTagName('head')[0].appendChild(s);

Hansel and Gretel's cookie trail

Been working with the Yahoo! User Interface JS library a lot lately, but it doesn't have a set of cookie functions baked in. Opted for the excellent functions that scored places #3, 2 and 1 (!!!) in Dustin Diaz's Top Ten JavaScript functions post. So far so delightful.

Syndicate content