SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict Jack Matier's Avatar
    Join Date
    Feb 2005
    Posts
    292
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Using the Hash Value properly. js/php

    I have a pretty neat system going on right now with the website I'm creating.

    For my links I have two portions. The first is the regular href for people that don't have javascript can navigate the site and the next an onclick for those with javascript can load pages inline with transitions and have it stay in their history for Firefox. All a la that wonderful ajax stuff everyone knows about by now.

    It seemed like a good idea at the time...
    Because it is stored in the #hash value these people can link another person that has javascript enabled as well to the page and have the page load. But that's it. So we have 96% some odd percent of users included.

    There is going to be confusion that happens if someone sends a link to someone without javascript, since it will just load the home page.

    From what I have researched.. the server doesn't pick up the #hash value (this is obvious since when you click on a link that's linking to a spot in the page, it's the browser doing the work). That's okay, the thing I want anyway is for it to pick up on the very first request via well.. something. The first request is when the server does do something and may have a chance to do something with a hash value.

    So questions:
    1. Can I manipulate the server into 'reading' this #hash value on the initial request and then put it through say.. php or mod_rewrite?

    2. What about css.. this is another client end thing that could work, but I am completely lost when it comes to css and recognising hash values. Even if it just works for Firefox/MSIE/Opera.. well.. that's something as it's non-intrusive and ups the people that can access my site properly.

    There is an option to post a noscript tag to notify users on the first load that their javascript is off.. but there's no way for php to also be smart and say "hey, there's a Hash value"... as it could, I would just load the page that way.

    The site is here:
    http://www.tinderbox.ca

    There is only two links:
    http://www.tinderbox.ca/#Home
    http://www.tinderbox.ca/#Contact

    Notice: On the first page load (set by a cookie that lasts a day)... it will display a light full-page flash animation that should last 3ish seconds. There is no sound in this animation.

  2. #2
    SitePoint Addict Mirek Komárek's Avatar
    Join Date
    Dec 2006
    Location
    Prague
    Posts
    210
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If people come not from tinderbox.ca they will have this info in referrer maybe you can check it and then rather replace url with hash by php to real page. But someone can block his referrer. It is very nice work there.

  3. #3
    SitePoint Addict Jack Matier's Avatar
    Join Date
    Feb 2005
    Posts
    292
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's a nice thought of a quasi solution, something which I was testing with two links.

    http://www.tinderbox.ca/redirect1.php#hash (gives you a link to redirect.php to click on).
    http://www.tinderbox.ca/redirect.php is the straight link that just echo's the referrer in php.

    With a cookie or session it can easily be created so that on the first visit it displays a message about javascript not being enabled.

    When we combine that with a redirect, like you say. It means that on first visit and referred directly and on first visit (from msn, yahoo etc) it would display the warning.

    This still leaves out linking from say.. gmail or a webpage if they do http://www.tinderbox.ca/#Contact . Which you know already I'm sure and I'm just rambling.

    Wow.. 96%, what a guess...
    http://www.thecounter.com/stats/2007/January/javas.php


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •