16 October, 2006

My own little daily WTF

And this is why people who are not programmers need to stay the fuck out of programming:

<form name="redirect">
<input type="hidden" name="redirect2">
<input type="hidden" name="thisurl" value="http://www.someplace.com ">
var targetURL= document.redirect.thisurl.value

var countdownfrom=10

var currentsecond=document.redirect.redirect2.value=countdownfrom+1
function countredirect()
if (currentsecond!=1)

To the uninitiated, or those that don't want to traverse the function, all this function does is redirect the browser to a new page, after 10 seconds.

Yes, a browser redirect in just under 30 lines of code. Simply amazing. My somewhat annoyed e-mail response:

Is there any reason you did not do something like?

<script type="text/javascript">
function newRedirect() { window.location="http://www.someplace.com"; }
<body onload="setTimeout('newRedirect()', 2000)">

Or, more importantly, instead have done this:

<meta http-equiv="refresh" content="2;url=http://www.someplace.com"/>

Not everyone has javascript turned on, whereas the meta refresh
method is supported by every modern browser out there.

And 10 seconds is an insanely long time to wait until redirecting.
Frankly, it should be an instantaneous redirect, with the text being
there to accomodate those people whose browsers do not support
whatever technology is being used to handle the redirect.

Generally a little more confrontational than my usual work e-mail tends to be, but damnit, it's just too early, and too Monday, for this kind of shit.

(And oh yeah, it only works in IE, because he doesn't provide a call to the main function in the onload method of the body tag. Way to test multiple browsers.)

No comments:

Post a Comment