How to detect/track postback in javascript?

ASPX:

<input type="hidden" id="_ispostback" value="<%=Page.IsPostBack.ToString()%>" />

Client-side Script:

function isPostBack() { //function to check if page is a postback-ed one
  return document.getElementById('_ispostback').value == 'True';
}

PS: I have not tested it but I’ve done somthing similar before and it works.

Leave a Comment