Archive for the ‘browsers’ Category

Developing for Opera

Thursday, July 16th, 2009

I’ve recently put a lot of time into Zemanta stuff working in Opera. There are a few things I’ve noticed that really bother me as a developer when developing for Opera.

OperaImage via Wikipedia
  1. The easiest way to be sure you’re getting a non cached file is to actually have it open in a tab and reload that tab. Emptying the cache does not seems to work as I’ve found out while caught in an alert loop.[1]

  2. I found the “don’t run scripts on this page anymore” checkbox in the alert box fascinating, but less so after I clicked it and couldn’t find a way to turn scripts back on for that specific page. Fortunately restarting the browser did the job.

  3. We load a loader.js that in turn loads other Javascript and CSS files. Unfortunately it seems I have to manually load these files in tabs in order to get them to work – even though I can see them in Dragonfly when I click them they seem to be blank. When I reload, the content appears. After that they work as expected. But even then I don’t see them loaded in the Network tab of Dragonfly.

  4. Can’t get the CSS loaded from a script to work. I don’t have any ideas, they just don’t work. I don’t see them in Dragonfly network tab (but I don’t see Javascript files either and they work).

  5. When using Dragonfly I cannot get out of the inspect DOm mode so I can’t use the site to do something while watching what is happening in the DOM – what you must do is switch to a different tab, do your stuff and then switch back.

  6. When you look at errors on a WordPress page Opera spits out loads of “-… is an unknown property” – thanks very much but properties that start with a – are supposed to be unknown to most of the browsers as they are vendor specific. This means that finding the error you’re looking for is much more difficult than it should be.

What I really hate the most when working with Opera is the lack of information about what is going on. They’ve added some really nice features in the recent releases but it is still quite far away from being a browser that people develop for. In this way it is sort of similar to IE but IE is a must and Opera isn’t…

If any of these are my mistakes I’d be glad if someone set me straight and taught me to use Opera as a developer. I bet others would too.

  1. When you have a loop that alerts something and you keep getting the alert – the only way of getting out is removing the alert from code, emptying cache and trying to hit reload between alerts. In Opera this does not seem to work as the only way to get the new file is to reload the file and you can’t do that between alerts. back
Reblog this post [with Zemanta]

Essential Firefox add-ons

Tuesday, April 7th, 2009

I’ve recently had to install a Firefox on the new iMac which lead me to ponder what add-ons do you really need.

Image representing Firefox as depicted in Crun...Image via CrunchBase

This is the list I compiled:


These add-ons will enhance the capabilities of your browser. You might not need them right away, but it’s smart to have them installed for when you need them (and I’m sure you will).

  1. Google Gears allows you to use off-line Gmail and makes a lot of web applications faster.
  2. Greasemonkey lets you install user scripts that will make pages nicer, give them additional features and other kinky stuff.
  3. Operator will expose microformated content so you can easily use it.


If you’re the dedicated support guy for this specific installation (people will call you when things go wrong) you should install these now – they’ll help you fix stuff later.

  1. Firebug will let you inspect pages and see what’s wrong and why.
  2. Html Validator validates the code on the page so it’s easier to spot why something looks weird on screen.
  3. Web developer toolbar adds a lot of useful features for debugging pages to a handy toolbar.


These are just a few I like that make the browsing experience a bit nicer.

  1. Cooliris makes searching for images a lot friendlier.
  2. FoxTab helps when you have lots of tabs open. Unfortunately it isn’t supported on Mac OS X 10.5.6 yet
  3. Inquisitor is a nice search add-on that will enhance the search box.
  4. Fission moves the progress bar into the address bar (Safari style).


To make your social networking and blogging a bit easier.

  1. Delicious is a great add-on if you use their social bookmarking service.
  2. Fotofox lets you upload photos to a bunch of photo sites easily.
  3. Zemanta integrates with your blogging platform and recommends images, videos, links, articles and tags.
  4. (Shameless plug) Tweecious is great for people who use Twitter and Delicious – it takes twittered links and posts them to Delicious.

You might also want to install dictionaries for the languages you use when writing in Firefox. You can get some more ideas at Fashion your Firefox.

Reblog this post [with Zemanta]

Speaking about the web of data

Wednesday, February 25th, 2009

Today at 19:00 CET I’ll be speaking at a local web meet-up about the web of data. There’ll be a live feed of the talk available and since I’ll be speaking in English you can tune it. This is a quick translation of the abstract posted on Slovenian sites:

Numerous services are emerging on the web that provide data in a computer friendly form through APIs, microformats, feeds,… Even your blog is actually a database as it syndicates its content via feeds and new posts trigger a ping you can subscribe to.

This fact opens new ways of collaboration – so called mash-ups, but this isn’t really a new concept. What’s new about it is the fact that we don’t use this word anymore as all the new services are some sort of a mash-up leveraging existing services. But accessing data is not the only way to leveraging these services – it’s becoming increasingly easy to create an application that lives in other applications without their approval through browser extensions and bookmarklets.

Marko Mrdjenovič from Zemanta will talk about what you can do to make your site more mash-up friendly and why that’s becoming increasingly important. As a developer I’ll also present what options you have and give a few tips on what to do and what to avoid when developing these kind of apps.

If you have any questions during the talk use twitter to tell me and I’ll try to answer them. Or put them in the comments.

Update: The video is now online. It’s in English so go watch it and tell me what you think.

Reblog this post [with Zemanta]

Don’t make an ASS of U and ME

Friday, February 20th, 2009

What’s wrong with the following line of code (from WordPress 2.6.5, common.js)?

jQuery(function(){jQuery('#media-buttons a').tTips();});

What guarantees do you have that by the time the internal function executes the global jQuery will still be the one you expect it to be or that it will have the tTips plug-in you attached a few lines earlier? Nothing. You just ASSUME it will be. You didn’t put it there, so you can be sure that nobody will. Right.

jQuery developers knew this might be a problem so jQuery will pass a reference to the itself as an argument when triggering this event:

jQuery(function($){$('#media-buttons a').tTips();});

This would work and wouldn’t break. And it would make your platform a bit more hackable.


Thursday, February 19th, 2009

There’s a really small probability that someone might need something like this but I did and I’d like to share it.

At Zemanta we have a few different ways of loading our scripts and we cannot always control when they do. The Firefox extension will load the scripts on DOM ready, WordPress plugin will load them somewhere in the middle of the HTML, Drupal and MovableType plugins will load them in the head and IE extension will load them sometime while loading the page.

This all means that we have to delay some of our code execution to when DOM is ready and scripts are loaded. Which is where the problem kicks in.

jQuery has this nice way of doing this with $(document).ready(fn) or short $(fn) which waits until the document is ready and executes the passed fn function. If the document is ready it will execute the function immediately. Our issue lies in what “document is ready” means to jQuery – it means different thing in different browsers.

In browsers that support DOMContentLoaded (Firefox, Webkit, Opera – let’s call them modern browsers) “document is ready” means that either DOMContentLoaded event fired on the document or the load event fired on its window. On IE “document is ready” means that either onreadystatechange fired with readyState === 'complete' on the document or document.documentElement.doScroll("left") is successful (Diego Perini hack). To make this short – if you load jQuery after all the events fired in modern browsers jQuery will never know that the document is ready.

To get around this (we really don’t like having our own hacked version of jQuery) I wrote this little plugin:

(function ($) {
$.readyOrDone = function (fn) {
	var s = document.readyState;
	if (s === 'complete') {

As you can see this will check if document is in a “complete” state and fire the ready method on jQuery which usually fires when DOM is ready – if it fired before it will do nothing. It will then add the function to the ready queue which also has this nice feature of firing immediately if DOM is ready.

All you have to do is change your $(fn) calls to $.readyOrDone(fn) and you have a bulletproof solution for executing functions when DOM is ready even if jQuery was late to the party and has no idea if the document is really ready.

Update: Filed a bug and hoping for the best.

Update 2: I found out that not all browsers provide the readyState property – Firefox on Ubuntu for example. Devised a new version that tries to smartly handle such cases:

(function ($) {
	var time = setTimeout(function () {}, 0),
		lastelm = null;
	$.readyOrDone = function (fn) {
		var s = document.readyState, getLast = function () {
			var elms = document.getElementsByTagName('*');
			return elms[elms.length - 1];
		if (s === 'complete') {
		} else if (typeof s === 'undefined') {
			lastelm = getLast();
			time = setTimeout(function () {
				if (getLast() === lastelm && typeof document.readyState === 'undefined') {
			}, 1000);
Reblog this post [with Zemanta]

jQuery transport is out…

Wednesday, October 1st, 2008
JQuery intermediate site

Image by Phillie Casablanca via Flickr

After a week of mostly testing and fine-tuning the code I finally released the windowName transport plugin for jQuery. You can get the plugin here but I suggest you first check the plugin page.

I need help testing

If you have an obscure browser / OS combination that is supported by jQuery I urge you to test the plugin. There are no good test pages yet so my temporary test page will have to do. The test page POSTs the querystring passed to it to a nonlocal domain and should open a JavaScript alert with the same querystring plus php=true.

On a sidenote – I figured out that the page looks better without the background images. So I changed the theme – let me know what you think.

Reblog this post [with Zemanta]