Hello All,
I am trying to use the code below in a JS header function called from a form hotspot
var targetURL = “http://db/agent?openagent¶m1=” + p1name + “¶m2=” + p2name;
self.location = targetURL;
This is code I have arrived at after about 45 tweakings; whatever I have tried to use, the agent only fires occasionally. When it fires correctly, it sends an email and adds some println statements to the server log. When it misfires, nothing happens. I preceded the agent call with an alert statement which shows the target URL is being constructed correctly but then…nothing. the server console, when the hotspot is clicked shows nothing either.
Anyone any ideas - all pointers gratefully received
thanks in advance
Dan
Subject: Caching issue
If the URL is identical, depending on various cache settings, the request might never reach the server.To fix this, simply make sure that the URL changes slightly every time, using a time-stamp:
var targetURL = “http://db/agent?openagent”;
var params = “¶m1=” + p1name + “¶m2=” + p2name + “&t=” + (new Date()).getTime().toString();
self.location = targetURL + params;
Thomas - IBM
Subject: RE: Caching issue
Thanks for your help Thomas,
I have added that additional parameter and used alert statements again to make sure the URL changes as one would expect and still the agent is only called occasionally.
I think you’re right about it being a caching issue. There are various other places in the application where this method is used, and all have been problematic since we moved to this R6 server. The agents either run intermittently, as in this case, or seem to run on demand for awhile and then stop for some reason.
If you/anyone could give me some pointers towards some relevant documentation that would be good - and yes, I have read the agent FAQ!
Thanks again
Dan
Subject: I use these meta tags to help reduce caching issues
Insert into your HTML Header section of the form:
“<META HTTP-EQUIV="Pragma" CONTENT="no-cache">” + @NewLine +
"<META HTTP-EQUIV="Expires" content="-1"> " + @NewLine
The @NewLine function isn’t required, but i find it helpful when reading the HTML source code. I think the second meta tag would be sufficient, but I always use both…
HTH