PostBack feature in JavaScript

Discussion in 'General Web Coding' started by kjtfs, Oct 24, 2003.

  1. kjtfs

    kjtfs Guppy

    I know that ASP has an IsPostBack funtion that is very useful for seeing if a page is being requested by a back, forward, .... method, but is there anything like it in JavaScript?? Right now I am doing it with cookies and it is about 60 lines of code where as I would much rather have one conditional call. I know I should just change the page to .aspx but I don't want to.


    Also if anyone has their screen resolution set to less than 1024X768 could you please test for me. You should get an alert on the first time you visit the page and not anyother times. Dont bother clicking the links this is only a test site for my new features. If you want the actual web site goto

    Thanks again,
  2. WineIsGood

    WineIsGood Perch

    You could do it the old way... just make a hidden form field with a value in it, then at the top of your code check for it. If it's blank, it's not a postback. If it's the value you placed in the form field, then it's a postback... because the definition of a postback is a form submit.
  3. StPatrick

    StPatrick Perch

    Besides this, you probably mean the function "Page.IsPostBack", which is available in ASP.NET only (not ASP)
  4. kjtfs

    kjtfs Guppy

    Yes StPatrick, I do mean ASP.NET, come on who is still using ASP?? Just Kidding. I did actually think about using a hidden label/control at first. But now that I have pondered on it for a while I think I will leave the cookies, I have more control of when they expire, I rather remind someone every 3 or so days about the alert not everytime they enter the site.


Share This Page

JodoHost - 26,000 hosting end-users in 100 countries
Plesk Web Hosting
VPS Hosting
H-Sphere Web Hosting
Other Services