Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Kim Andersen 1447 posts 2196 karma points MVP
    May 28, 2010 @ 08:54
    Kim Andersen
    0

    Check to see if user comes from certain page

    I have a question to all of you XSLT-gurus out there.

    Somehow I'd like to know where the user comes from when they navigating in to one of my pages. What I'm trying to do is this:

    When a user enters one of my pages called infopage, I need to show some information on that page. This information should be shown to all users - except user comming from one of my other pages called resultlist. Does this make sense at all to you?

    The resultlist contains links to infopage. I know this could be done by sending a parametre in the url such as infopage?comesFrom=resultlist, and if the "comesFrom"-parametre was equal to "resultlist", I shouldn't show the information. But this is not an option.

    I hope this makes sense, and that some of you guys have a clever suggestion on what to do.

    Thanks in advance.

    /Kim A

  • Chriztian Steinmeier 2800 posts 8790 karma points MVP 8x admin c-trib
    May 28, 2010 @ 09:30
    Chriztian Steinmeier
    1

    Hi Kim,

    Have you tried using the HTTP_REFERER ServerVariable - seems to me that should be able to do the trick?

    /Chriztian

  • Chriztian Steinmeier 2800 posts 8790 karma points MVP 8x admin c-trib
    May 28, 2010 @ 09:35
    Chriztian Steinmeier
    1

    Something like this:

    <xsl:variable name="referrer" select="umbraco.library:RequestServerVariables('HTTP_REFERER')" />
    
    <xsl:variable name="cameFromResultList" select="contains($referrer, '/resultlist.aspx')" />
    
    <xsl:if test="$cameFromResultList">
    ...
    </xsl:if>

    /Chriztian

  • Kim Andersen 1447 posts 2196 karma points MVP
    May 28, 2010 @ 10:13
    Kim Andersen
    0

    Yeah that would work Chriztian - thanks.

    But I have just found out that it's actually not that simple. Because on the infopage I have some different tabs, each with seperate url's like this: infopage/project, infopage/contact ect. When I click one of the tabs and then return to the infopage, the information still shouldn't be shown. But of cource the referer does not contain resultlist anymore, when the user comes from infopage/contact. I know that I could test for the referer containing contact, but this would then also be the case when the user is going directly from anywhere on the site, then into the infopage/contact and the to the infopage.

    I think I'll give it an hour or so, and then see if I can come up a  smart way of handling this. If some of you have a clever idea of handling it just say so :)

    /Kim A

  • Chriztian Steinmeier 2800 posts 8790 karma points MVP 8x admin c-trib
    May 28, 2010 @ 10:19
    Chriztian Steinmeier
    0

    Ah OK - the plot thickens :-)

    Depending on the sensitivity of the information (you know, do you need "military-level" security or are you just providing a "convenience layer" of exclusion) you might get away with a cookie that's set upon entry from the resultlist page, which lasts for the rest of the session?

    /Chriztian

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    May 28, 2010 @ 10:27
    Lee Kelleher
    0

    I haven't actually used this in a production environment, only played with it... but how about enabling stats? (Setting "umbracoEnableStat" to true in Web.config).

    The database table "umbracoStatEntry" has a few columns, EntryTime, RefNodeId and NodeId.

    Could that be useful?

    Otherwise, I'd be tempted to go with a custom tracking cookie, something simple that has a CSV of nodeIds visited.

    Cheers, Lee.

Please Sign in or register to post replies

Write your reply to:

Draft