SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Addict IsaacV's Avatar
    Join Date
    Jan 2002
    Location
    Saint Petersburg
    Posts
    246
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    JavaScript Manipulating History.

    Hi,
    I'm designing a web site and I designed an error page with .htaccess so that when someone types in an incorrect URL, it takes them to my customized page. Well, I used server-side programming to make it log the bad URL and check against a database if the there is a good URL matching the bad one. If so, it redirects to that page instead of giving the error. It's a good, well-written script done by me, I'll give it to anyone that requests it.

    What I want to know is if JavaScript can prevent a page from being logged in the visitor's browser history.
    You see, when they click the back button, the revisit the error page and it relogs the bad URL.

    Is this possible in Javascript?

    http://www.sitepointforums.com/showt...threadid=74992
    Pants.
    Join the NYFlava Fashions Contest

  2. #2
    SitePoint Guru bronze trophy blufive's Avatar
    Join Date
    Mar 2002
    Location
    Manchester, UK
    Posts
    853
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yikes. I have to say, I doubt it. In your favour, Mozilla already has the feature/bug* of not including certain redirects in the history, i.e. the URL that does the redirect gets left out of the history, which seems to be what you want to do anyway.

    *delete as applicable to your point-of-view. There's still some... uh... energetic debate over this.

    That said, I'm not aware of any browser that lets you manipulate its history. Even if some do, others will probably refuse to do so, on the principle that the history is there for the USER's benefit, not the webpage's.

  3. #3
    The doctor is in... silver trophy MarcusJT's Avatar
    Join Date
    Jan 2002
    Location
    London
    Posts
    3,509
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Rather than do a response.redirect on the error page, you should response.write some JavaScript code which does a location.replace(url). This will ensure that the error page does not remain in the browser's history.
    MarcusJT
    - former ASP web developer / former SPF "ASP Guru"
    - *very* old blog with some useful ASP code

    - Please think, Google, and search these forums before posting!

  4. #4
    SitePoint Addict IsaacV's Avatar
    Join Date
    Jan 2002
    Location
    Saint Petersburg
    Posts
    246
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by M@rco
    Rather than do a response.redirect on the error page, you should response.write some JavaScript code which does a location.replace(url). This will ensure that the error page does not remain in the browser's history.
    I'm sorry, what?

    I only know basic Javascript, could you explain?
    Pants.
    Join the NYFlava Fashions Contest

  5. #5
    The doctor is in... silver trophy MarcusJT's Avatar
    Join Date
    Jan 2002
    Location
    London
    Posts
    3,509
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    <%
    'error logging stuff goes here
    
    'now send browser to desired page,
    'replacing the current url in the history list
    response.write "<script language='javascript'>"
    response.write "location.replace('home.htm');"
    response.write "</script>"
    %>
    MarcusJT
    - former ASP web developer / former SPF "ASP Guru"
    - *very* old blog with some useful ASP code

    - Please think, Google, and search these forums before posting!


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
  •