Welcome to the new platform of Programmers Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use it's exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
I am very new to script programming, and I was wondering how I would go about having a pop-up window appear for a user if the page they are visiting has been modified since their last visit?
Here is the code that someone has recommend for me to use, but the prompt seems to appear everytime you access the page rather than only if the page was modified since their last visit. Is there something I should change?
Any help would be greatly appreciated
(sorry about the length of my post)
'The following script tells the browser not to cache the page and also that the page has expired. Everytime the browser visits this page he is forced to request a new version of the page from the server.
Response.Expires = 60
Response.Expiresabsolute = Now() - 1
Response.CacheControl = "no-cache"
'Check the cookie exists, LastVisit is the cookie name.
cookieFound = FALSE
IF Request.Cookies("LastVisit") <> "" THEN
'The cookie exists, read it, and convert it into a VBScript date format
newCookie = CDate(Request.Cookies("LastVisit"))
cookieFound = TRUE
'Set the next cookie date/time to be the current date/time
Response.Cookies("LastVisit") = CStr(Now)
strFileName = Request.ServerVariables("SCRIPT_NAME")
strFileName = Replace(strFileName, "/", "")
strFileName = Server.MapPath(strFileName)
Set objFileSystemObject = Server.CreateObject("Scripting.FileSystemObject")
Set objFile = objFileSystemObject.GetFile(strFileName)
dtmLastModified = objFile.DateLastModified
dtmLastAccessed = objFile.DateLastAccessed
Set objFile = Nothing
Set objFileSystemObject = Nothing
dtmLastModifiedDate = FormatDateTime(dtmLastModified, 1)
dtmLastModifiedTime = FormatDateTime(dtmLastModified, 3)
'Writes the last modified date/time into the specified format
'Response.Write(dtmLastModifiedDate & " " & dtmLastModifiedTime)
'Writes the last modified date/time into the default format
'The following calculates the difference newCookie-dtmLastModified and returns the result in seconds "s"
'checkDateDiff = DateDiff("s", dtmLastModified, newCookie)
IF dtmLastModified >= newCookie THEN