688 items tagged “javascript”
2006
Form Hijack (via) Neat unobtrusive JavaScript trick—use document.onclick to catch events before page has loaded.
My ETech JavaScript tutorial
I gave a three hour JavaScript tutorial at ETech this morning, aimed at people with previous programming experience who hadn’t yet dived deep in to JavaScript as a programming language. It seemed to go pretty well—some good questions were asked at various points and a few people told me afterwards that they had found it interesting.
[... 247 words]Yahoo! UI JavaScript treats
The Yahoo! Developer Network was updated yesterday with a veritable gold-mine of Exciting New Stuff, coinciding with the launch of the brand new Yahoo! User Interface Blog.
[... 576 words]Yahoo! UI Library. Open Source JavaScript widgets and libraries.
Escaping regular expression characters in JavaScript
JavaScript’s support for regular expressions is generally pretty good, but there is one notable omission: an escaping mechanism for literal strings. Say for example you need to create a regular expression that removes a specific string from the end of a string. If you know the string you want to remove when you write the script this is easy:
[... 362 words]2005
The Dojo Manual (via) Dojo finally gets some really good extensive documentation.
Don’t be eval()
JavaScript is an interpreted language, and like so many of its peers it includes the all powerful eval()
function. eval()
takes a string and executes it as if it were regular JavaScript code. It’s incredibly powerful and incredibly easy to abuse in ways that make your code slower and harder to maintain. As a general rule, if you’re using eval()
there’s probably something wrong with your design.
Rich Text Editing With Dojo. Utterly fantastic. Beautiful API, and it even works in Safari.
TurboDbAdmin. Ajax phpMyAdmin clone built on Dojo. Worth trying the live demo.
Firefox 1.5 developer highlights
Firefox 1.5 Beta 1 is out, and is the most exciting browser release in a very long time. It comes with the Gecko 1.8 rendering engine, which includes a ton of interesting new features. New in this version (unless you’ve been tinkering with the Deer Park series):
[... 719 words]Understanding the Greasemonkey vulnerability
If you have any version of Greasemonkey installed prior to 0.3.5, which was released a few hours ago, or if you are running any of the 0.4 alphas, you need to go and upgrade right now. All versions of Greasemonkey aside from 0.3.5 contain a nasty security hole, which could enable malicious web sites to read any file from your hard drive without you knowing.
[... 809 words]Staying social
June is finals month, but the call of @media 2005 is hard to resist. I won’t be attending the actual conference (sadly my student budget doesn’t stretch that far) but I’ll be in London on Saturday the 11th to ride on the coat-tails of the conference.
[... 174 words]Stuart’s book
I meant to mention this earlier, but Stuart’s book, DHTML Utopia: Modern Web Design Using JavaScript & DOM, has been published. I worked as a technical editor on the book, and I’m proud to have been associated with it. Don’t worry about the hairy title (apparently you have to have DHTML in it or bookshops won’t know where to put it / people won’t know what it’s about), the inside is pure gold. In their usual style, SitePoint have posted the first four chapters online for your perusal so you don’t have to take my word for it, you can try it out for yourself.
Firefox Counter. How the Firefox counter works.
Safari 1.3 has a JavaScript Console
My single biggest complaint about Safari in the past has been its terrible support for JavaScript debugging. Safari 1.3 has just been released, and tucked away in the Debug menu is a brand new JavaScript console option. It’s not as good as the Firefox equivalent (it throws up far too many “Undefined value, line: 0” errors for my liking) but it’s a big step in the right direction.
Flickr without the Flash
One of my favourite panels at SxSW this year was the Flash vs. HTML Game Show, in which a team of HTML/JavaScript gurus took on a team of Flash gurus showing off pre-prepared solutions to tasks set for the panel. One of the challenges was to come up with enhancements to Flickr using the team’s assigned technology.
[... 353 words]Ajax forest, Remote Scripting trees. Brent Ashley, father of the JSRS library, kicks in on Ajax.
Greasemonkey: Hacking the Web with JavaScript. Greasemonkey rocks! Here’s a simple tutorial from Michael Moncur.
2004
The Register hit by XSS
Here’s a nasty one: popular tech news site The Register was hit on Saturday by the Bofra exploit, a nasty worm which uses an iframe vulnerability in (you guessed it) Internet Explorer to install nasty things on the victim’s PC. Where it gets interesting is that the attack wasn’t against the Register themselves; it came through their third party ad serving company, Falk AG.
[... 262 words]2003
Silly JavaScript Security. “Sorry, you do not have permission to press this key,”
The good and the ugly
PHP.net has a new feature on their search page—a really nice implementation of an auto complete text widget in Javascript. Even better, the search page is valid XHTML 1.0 Strict and uses CSS for the layout. Let’s hope this is an indication of things to the come for the rest of the site, which still mostly consists of tag soup.
[... 368 words]getElementsBySelector()
Inspired by Andy, I decided to have a crack at something I’ve been thinking about trying for a long time. document.getElementsBySelector
is a javascript function which takes a standard CSS style selector and returns an array of elements objects from the document that match that selector. For example:
Image Drag bookmarklet
I got a good response to yesterday’s call for help on finding an HTML element’s co-ordinates on a page. I ended up using PPK’s findPos functions which seemed to do the trick just fine.
[... 338 words]2002
Blockquote citations
Inspired by Adrian Holovaty, I spent an hour this morning getting dirty with the DOM in an effort to replicate his funky CSS blockquote citations effect but with links that you can actually click on. The resulting code is now active on this weblog—check the javascript out here.
[... 86 words]Blogchat rocks
I spent a while today over at Brent Ashley’s blog chatting away on BlogChat. BlogChat is Brent’s impressive DHTML chat system (backend in PHP, front end via JSRS) which allows anyone visiting his blog to talk to him (and other visitors) in real time, provided he is online to host the session. During the afternoon I got to talk to people from all over the world, all with similar interests because they all had the same taste in blogs. I am hoping to install a version of Brent’s system on this site in the not-too-distant future.
JSRS 2.1 released
Brent Ashley: JSRS2.1 Released (from June 10th—Internet Archive copy). JSRS is Javascript Remote Scripting, an incredibly powerful javascript library that allows DHTML pages to communicate with a web server without having to reload the page. This latest version fixes POST suport for Mozilla. The library opens the way for a whole host of interactive web applications without the normal limitations caused by the request-and-response nature of the web. Best of all, JSRS is cross platform (at least for Mozilla, NS4+ and IE4+).
[... 151 words]Tree from unordered list
The amazing tree generator (via webgraphics, who in turn got it from CSS Discuss). This is just the kind of DHTML I really like. Place a simple nested unordered list in your document and this external javascript can use the DOM to convert the list in to a hierarchical outline style tree, with each node expandable to show the child members. It looks great and works in both IE and Mozilla—I haven’t tested it in other browsers but it should degrade gracefully, leaving them with a static nested list.