Retrieve Browser History?

Discussion in 'Classic ASP' started by westmiller, Mar 5, 2005.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. I would like to access the browser history to store the
    previous site accessed by a visitor, as aguide to possible
    links or promotional responses.
    I've tried window.history.back in every configuration that
    I can imagine, but it doesn't give me the URL or even IP
    address text string. Is there some variation that produces
    a value, rather than a forced execution of the page?

    Bill
     
  2. Bruce

    Bruce DiscountASP.NET Staff

  3. westmiller - sorry to say this, but i hold with the other guys.

    there is no way, without using exploits and installed ActiveX components, that you can retrieve that history. it is simply not available to you..simple as that.

    what your credit card gateway company uses is simple - they either check the refering url OR have variables in place (such as a GUID) in order to validate where the transactional details are coming from - if at all.

    the window.history.back command interacts with the browser itself as per the standards that are laid down for JS. it does so without any knowledge (or care) as to where the user was last but simply retrieves the page located in the cache and display it (if there is one).

    There is also no way for you to retrieve that information through window.history.back...try it..


     
  4. > you cannot access your visitor's browser cache!

    I can. [​IMG]
    It'sa cludge using an invisible frame, but I'd much
    rather have a a direct call to the cache ... which is
    what window.history.back retrieves and executes.
    My credit card processing company uses the last
    URL as a validation for the originating source ... which
    they're not pulling out of a hat. So do the various web
    history files that report the 'originating source' for all
    visitors.
    Granted, it's probably on page 2,692 of the tech
    manual, but I don't have that reference.

    Bill
     
  5. Mike: You can easily check the referer...

    That would probably be adequate for my needs. What's the code?

    Point me to your kludge solution ...

    I'll post it somewhere if you'd like, but it simply uses the ability of one frame to change another frame's URL ... with history.back ... then read the URL of that other frame.

    BIll
     
  6. Are you sure they're using the "last URL" or are they simply using the refering URL. Very different things.You can easily check the referer... You cannot, however, simply access the entire URL history.

    Point me to your kludge solution and I'll go there and you can post my browser history. I'd like to see it actually work.


    Mike Reilly, Secretary/Webmaster
    Kiwanis Club of Rancho Penasquitos
    "Serving the Children of the World"
    [email protected]
    www.KiwanisPQ.org
    (760) 419-7429
     
  7. westmiller: ah i see. but you're not actually accessing the cache or the history directly - but grabbing the url from the page itself when it's loaded.

    To get the referer url:

     
  8. ... you're not actually accessing the cache ...
    Just pulling it out of a 'magic box' [​IMG]


    ... ServerVariables("HTTP_REFERER")


    That's just fine. It wasn't on the list that
    I had. And thanks for the link to w3schools.com
    ... looks like an excellent resource!


    Bill
     
  9. yeah, you can specify how far back in history you want to go..not sure what the limitations are though.

    ----
    Brian H. Madsen
    Microsoft SQL Server IG Perth - Organiser
    http://www.sqlserver.org.au
     
  10. yes westmiller..it IS on the list..second last one...


    Are you running on DiscountAsp servers? When
    I generate the list, the last two items are HTTP_HOST
    and HTTP_USER_AGENT. When I call HTTP_REFERER
    from one page to another, the variable is null.

    ... are you trying to find out what site people are
    coming from OUTSIDE of your own domain ...

    Yes. The objective is to identify sites that might
    have posted a link or reference to my URL. I thought
    that it might be a simple matter of retrieving the
    *content* that is executed by window.history.back
    ... but that seems not to be accessible
    ... only executable.[​IMG]

    I don't want the visitor to actually goback(1),
    nor even to see the results. I simply want to store
    that information in the user database for my future
    reference.

    The kludge of creating an invisible frame to actually
    go back(1) there, and then retrieve the URL of that
    frame, seemed to be the only method of getting the
    information. I expected that I would have to filter
    out references with my own URL from that history.

    Bill
     
  11. ... ServerVariables("HTTP_REFERER")


    That's just fine ... except it doesn't work. [​IMG]
    It does NOTshow up on the server.variable list
    code which was offered at the site you suggested ...
    and I've tried a redirect ... unless it only reports
    referals from off-server?


    Bill
     
  12. yes westmiller..it IS on the list..second last one...

    I think a scenario here is going to be needed....are you trying to find out what site people are coming from OUTSIDE of your own domain or are you trying to find out where they were last on your own site?

    i think it would be smart to paint out the entire scenario so that it'll be easier to help you as you constantly add small "buts" in there..so if you want more help, please say EXACTLY what it is your trying to do/need to do.

    ----
    Brian H. Madsen
    Microsoft SQL Server IG Perth - Organiser
    http://www.sqlserver.org.au
     
  13. Sorry for the delay in responding.. long day. Looks like everyone else took care of you though. But now you've got my interest peaked. I wonder if you cando history.go(-3) and see what is 3 pages back? That might prove to be a nifty tool. I'll have to check it out.


    Mike Reilly, Secretary/Webmaster
    Kiwanis Club of Rancho Penasquitos
    "Serving the Children of the World"
    [email protected]
    www.KiwanisPQ.org
    (760) 419-7429
     
  14. >> When I call HTTP_REFERER from one page
    >>to another, the variable is null.

    Got around to trying this from one URL to
    my DiscountAsp.Net site ... still a NULL value.


    >> Are you running on DiscountAsp servers?

    Any chance we could get the DiscountAsp.Net
    webmasters to implement HTTP_Referer?

    Bill
     
  15. Can you post code, because there's no reason that shouldn't be working. Try going here..... http://www.kiwanispq.org/referer.asp


    The code is simple:


    <%
    myReferer = Request.ServerVariables("http_referer")
    If myReferer = "" Then
    Response.write "There is no referer information available. You may have loaded this page directly."
    Else
    Response.write "You came from " &amp; myReferer
    End If
    %>


    And yes, that page is on a DiscountASP server. There is nothing they need to change to make it work.
















    Mike Reilly, Secretary/Webmaster
    Kiwanis Club of Rancho Penasquitos
    "Serving the Children of the World"
    [email protected]
    www.KiwanisPQ.org
    (760) 419-7429

    Post Edited (Mike Reilly) : 3/18/2005 7:32:28 PM GMT
     
  16. Problem solved! [​IMG]


    HTTP_Referer does work ... sometimes.
    I was using a response.redirect to advance to
    page that reported. In that case, it does not get
    the refering source URL. When I changed it to a
    simple hyperlink, it reports correctly!
    And, it does report hyperlinks from the same
    URL, so I'll need to filter the responses to elminate
    the referalsfrom my own pages.
    But ... the HTTP_REFERER still doesn't appear
    when I cycle through all server.variables ... don't
    really care why not.
    Thanks for the tip.


    Bill
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page