Little JavaScript code at top of article pages



  • Apologies if this has been asked before, but searching the forums for "javascript", "wtf" or "article" seemed unwise, and google didn't help much either.

    Anyway, does anyone know about the little JavaScript function declared at the top of TheDailyWTF article pages? It goes like this:

    <script type="text/javascript">
        function wtf(wtf) { location = wtf +  "7417" }
    </script>

    AFAICT it's not really used anywhere.

    I checked the HTML of some of the previous articles, and the number seems to be increasing in time, so naturally I'm thinking it's some sort of ID.

    Perhaps this function is used by users with different permissions than me? Or am I missing something?



  • Sounds like something meant to circumvent browser caching.



  • @db2 said:

    Sounds like something meant to circumvent browser caching.
     

    It doesn't. For circunventing the cache you must put it in the URL, not in the data.

    The cache only sees that the function changed after it decided to make another request.



  •  Maybe some sort of wtf flavoured nonce?



  • @Mcoder said:

    @db2 said:

    Sounds like something meant to circumvent browser caching.
     

    It doesn't. For circunventing the cache you must put it in the URL, not in the data.

    The cache only sees that the function changed after it decided to make another request.

    There is something of this sort in there:

    <!-- Begin -  Site: The Daily WTF Zone: Leaderboard -->
    <script language="javascript"  type="text/javascript">
    document.write('<s'+'cript lang' + 'uage="jav' + 'ascript" src="http://thedailywtf.com/tizes/a.aspx?ZoneID=2&amp;Task=Get&amp;IFR=False&amp;PageID=55152&amp;SiteID=1&amp;Random=' + (new Date()).getTime() + '">'); document.write('</'+'scr'+'ipt>');
    </script>
    <noscript>
        <a href="http://thedailywtf.com/tizes/a.aspx?ZoneID=2&amp;Task=Click&amp;Mode=HTML&amp;SiteID=1&amp;PageID=55152" target="_blank">
        <img src="http://thedailywtf.com/tizes/a.aspx?ZoneID=2&amp;Task=Get&amp;Mode=HTML&amp;SiteID=1&amp;PageID=55152" width="728" height="90" border="0"  alt=""></a>
    </noscript>
    <!-- End -  Site: The Daily WTF Zone: Leaderboard -->

    There is something beautiful about a JavaScript element with code for writing another JavaScript element.

    Oh, and accessing those URLs inside the <noscript> element just gets you 404s.



  • I put a breakpoint on it in Chrome and the only time I hit the breakpoint was on page load. I would tentatively say that the function is never actually called and may just be a relic in the source.



  • Maybe the editable version of each page is accessed through some wtf-filled bookmarklet that calls that function. Self-commenting code!


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.