Archive for the ‘javascript’ Category

Refresh Current Page in JavaScript

It’s more annoying than it sounds. You could do the classic:

window.location = window.location; //refresh lol!

But you’ll get screwed if there is a fragment, like, say, http://example.com/index.html#section1. The page won’t refresh. Or rather, it will, but browsers won’t send a request to the server if the url contains a fragment. It will just try to navigate [...]

May 9, 2010   Posted in: javascript, web development  2 Comments

Get Computed Style in JavaScript

The computed style of an element incorporates external CSS (via stylesheets), inline styles and styles prescribed via JavaScript. It’s most commonly used to get the default style of an element if it’s not specifically assigned via styles, i.e. the default style that the browser gives an element. It’s a very undocumented part of JavaScript engines, [...]

April 5, 2010   Posted in: javascript, web development  No Comments

top != self and fun with the Tokelauans

I noticed recently that THE GREATEST SITE IN THE WORLD had a new referrer. I checked it out, and saw this:

A touch of JavaScript, and now they see this:

Just say NO to frames. And kiwis.

January 26, 2010   Posted in: javascript, rants  No Comments

Intro to Functional Programming via JavaScript

This is purely an academic exercise. Adam contacted recently with a link to a blog post on implementing the Y-combinator in JavaScript. There were a whole bunch of words that sound smart, such as

Recursion
Fixed point
Y-combinator
Memoization

It’s like a professor’s dream come true. I had seen the article a long time ago when I prepared a presentation [...]

January 2, 2010   Posted in: javascript  No Comments