Christian Heilmann

You are currently browsing the archives for the Experiments category.

Archive for the ‘Experiments’ Category

Don’t rely on maxlength to shorten passwords

Monday, February 6th, 2006

It is bad practice to rely on the maxlength attribute of form fields to ensure the real length of entered data. That much I knew, as playing with curl made me aware how vulnerable forms are on the wild wild web.

However, I was a bit agog when I realised that it is possible to change the value of a field to a word longer than maxlength on MSIE and Opera.

I set up a demo that shows how to override maxlength with JavaScript .

So, don’t trust maxlength, make sure to also check the real length on the server side.

Panel Bar or Accordeon Menu using DOMscripting and CSS

Thursday, February 2nd, 2006

A friend of mine asked for a menu like the Outlook Panel in CSS and JavaScript as a proof of concept. I took on the challenge and quickly put together this example of a DOMscripting powered panel menu . It functions the same way – only one section can be open at a time – and should be rather self-explanatory. For a change I am not using off-left to hide the sections but plain old display block and none inside the script, which has the welcome side effect that you can use it with a keyboard without having to tab through the invisible links!

Features:

  • Fully contained unobtrusive JavaScript
  • Option to style JavaScript and non-JavaScript menu independently
  • Option to have predefined open section

I hope it is helpful for some of you, and I appreciate any feedback / bug issues.

Internet Explorer 7 beta out

Wednesday, February 1st, 2006

Microsoft (no, I will not link this one) have shipped a beta of Internet Explorer 7 . It looks quite funky and requires XP SP2 to run. The catch is that it actually replaces your old MSIE6 (hey we all want that), which can be a real issue for testing. You can install the MSIE6 standalone alongside, but allegedly this might cause problems.

Therefore it might be best to install the MSIE 7 standalone version instead.

As for taking the new shiny MSIE for a ride, there is a test case collection going on at the CSS discuss wiki.

Form data preview with DOM

Monday, January 30th, 2006

I got asked to set this up as a proof of concept for an upcoming project, and it might be helpful to you guys, too:

Previewing collated form data with DOMscripting

The code is a bit wooly at the moment and I will clean it up and explain a bit more if I get the time.
In the meantime, just give it a swirl.

Help stress-testing a DOMscripting helper library / object

Sunday, January 22nd, 2006

Following a thread on the evolt list about reading the next sibling element of a current element and making sure it really is an element and not a text node (line break), I decided to add a small helper object to my upcoming JavaScript book that takes care of some of these issues.

Give it a try: DOMhelp

My questions now are:

  • Is that something that really can help save beginners frustration
    about different browsers and DOM oddities?
  • Is it pretty bullet proof?
  • can you think of other methods that should be in there?

I promise to add a greeting, should you come up with something I
forgot or find out I did wrong. I don’t get many free copies though…

:-)

I am aware that there are a lot of libraries already out there, but
most of them are just too massive to use in a beginner book.