Posts Tagged ‘browser’

Legacy css support for IE6, without conditional comments

Thursday, December 17th, 2009

and without automated preprocessing. This is just one possible solution of course and it’s nothing new; make this the very first javascript file or part of it (in the head, where I still think javascript shall go):

(function(){
if (window.ActiveXObject && !window.XMLHttpRequest) {
var timer = function(){setTimeout(function(){
document.body ? $("body").addClass("legacy") : setTimeout(timer, 100);
}, 100)};
timer();
}
})();

Enough said.

Mouse gestures in Chrome (and elsewhere)

Friday, September 11th, 2009

After checking the gestures extension for Chrome/Chromium I decided to use a small freeware utility instead, StrokeIt, which is free for personal use and can recognize mouse gestures, convert them to shortcuts or messages and send them into applications – and has an extremely small memory footprint. Really nice indeed!

But what’s the problem with the extension? The fact that it uses the document.body to capture the gesture means that it will have a hard time with the mouse crossing document boundaries – iframes for example (which are widely used with banners and widgets/gadgets), so unless you implement the gesture system in the application itself (Opera) or give a greater control to the extension (XUL) this is not a way I want to go with.

For Linux I’m sure a similar solution exists (probably something -l -i |ke –this| or > similar &) and Apple people always have their nicely designed shareware software with an ever awesome gui and candy-cute icons – though most of them aren’t aware that browsers other than Safari do exist.

Firefox 3.5 not-so-awesome bar

Saturday, August 22nd, 2009

Since the 3.0 series (released more than a year ago) the url bar is driving me nuts: sometimes it takes 7-10 seconds to come up with the first possible url and locks the browser until then; I really don’t like tweaking the about:config page, but I did do that for this one; now it’s okay – still, it’s a shame: we have canvas, html 5 video, css 3 selectors, new gradient crap is coming up, yet the ui still has some unfixed problems…

EDIT: false alert. Still sucks; maybe if I delete all my bookmarks AND empty the history each and every day… but wait, what’s the point in having this awesome location bar then?

Ad blocking for Google Chrome (Chromium)

Friday, August 7th, 2009

Google Chrome’s bleeding edge developer version Chromium supports user scripts (like GreaseMonkey on Firefox) and extensions, though both of these are still under development. First download the latest nightly Chromium build, unzip it, and create a shortcut to the chrome.exe file with the parameters:

--enable-user-scripts --enable-extensions --load-extension="c:\chrome_extensions\adblock"

Again, create a directory for the extensions: I myself used c:\chrome_extensions in the above example; create a subdirectory adblock in that. Yes, we’re going to use an “extension”, instead of a user script; why? Because both for me and for Yaanno user scripts were flaky, caused lots of crashes and they did not work (as of this writing; in the future I’m sure they will).

Create a manifest.json file in the adblock directory:

{
"name": "Simple AdBlocking",
"version": "1.0",
"description": "AdBlocking via CSS rules",
"content_scripts": [
{
"matches": ["http://*/*"],
"css": ["adblock.css"]
}
]
}

Now create an adblock.css file; I have some rules I wrote myself, but probably the best idea is to copy paste a userContent.css filled with adblocking rules. So this is just a small example (don’t forget, Chrome can deal with some pretty powerful css3 selectors):

div[id^=superbanner],
div[class^=hirdet],
div[id^=adocean],
div[id$=banner],
div[id$=adlink]
{ display: none !important; }

Now start Chromium with the shortcut; you can see, reload or remove the installed extensions at chrome://extensions – hopefully now you have less ads around. Still, this is a very crude solution; hopefully user scripts will be more stable/usable soon: using those with run-at document-start will give us even more power than with GreaseMonkey.

Be aware that if you want to use multiple extensions together, as of this writing you have to package them into crx files using a python tool!!

Firefox history cache

Tuesday, August 4th, 2009

Just a note to self: Firefox caches pages with back/forth button in a way that no javascript is run again – which is a dealbreaker with some ajax pages. Add a script tag with an alert just to the very beginning of the head tag, navigate away from the page and come back: no popup; I did forget about this one… Solution:

window.onbeforeunload = function(){};