Re: Is there a way to distinguish an auto-refresh from a manual page load? [message #177192 is a reply to message #177189] |
Sun, 26 February 2012 08:31 |
crankypuss
Messages: 147 Registered: March 2011
Karma:
|
Senior Member |
|
|
On 02/25/2012 10:21 AM, Beauregard T. Shagnasty wrote:
> bill wrote:
>
>> The Natural Philosopher wrote:
>>> Álvaro G. Vicario wrote:
>>>> The Natural Philosopher wrote:
>>>> > Cos I want to make a page slightly different depending... ..I cant
>>>> > think of any parameter I might pass that would be affected by
>>>> > autorefersh or not tho.
>>>> >
>>>> > Maybe javsacript and a timer would enable one?
>>>>
>>>> The "auto-refresh" concept implies some previous work on your side.
>>>> It'd help a lot to know what's the code you wrote to accomplish it
>>>> (JavaScript,<meta> tag or whatever). Whatever, I have the impression
>>>> that it'd help even more to know the problem you want to fix rather
>>>> than just the solution you figured out.
>>>
>>> Well I used a meta tag so that the client refreshes in case new info
>>> has come in.
>>>
>>> However in this case the client can also POST new information, and I
>>> don't want it POSTING the same information every 5 minutes or whatever.
>>>
>>>
>>> The idea is to construct a not very real time view (5 minute
>>> granularity is good enough) on some data, some of which the user can
>>> change.
>>>
>>> I haven't tested it to see if a refresh is actually different from a
>>> submit.
>>
>> UNTESTED:
>> On the original submit, attach a parameter with a random number.
>> Keep the sequence number in your database. On every invocation
>> of the php script, check the number in the database. If it is the same
>> as last time, it is a refresh. bill
>
> ..unless another visitor views the page in between. This 'database' would
> have to also include at least the IP address and the random number, or
> perhaps the IP and the date/time and the random number to ever have a
> shot at being close.
That's where the concept of a user session comes in handy. I've been
doing other things for some time now, but prior to that I was building a
text editor and it was able to flawlessly detect re-sends of POST-ed
information, etc. The underlying code is doubtless more complex than
most people would care to deal with, but it is possible.
|
|
|