Rahul, I don't think you're going to find a reliable way to ensure that the APIs are called from the browser. There are too many ways for the user to close the browser, or for the browser to crash, or for the browser to lose connectivity to the server unexpectedly (ISP has a glitch, local wireless router has a glitch, laptop carried too far from the WiFi router, cell phone enters a tunnel or drives into some other dead zone), etc. Instead, you may want to do something like this to handle the cases where the user never clicks your end-call button: - Have a frequent timer in the browser make an Ajax call to the server saying that it is still active -- a "keep-alive" or "heartbeat" call, as it is sometimes known. - Have a server-side process do the necessary cleanup that the API call would have done, but only if the keep-alive calls stop coming in. --Fred Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/ Bristle Software, Inc -- http://bristle.com -- Glad to be of service! Open Source: Without walls and fences, we need no Windows or Gates. On 5/31/17 5:05 PM, Rahul Paul wrote:
-- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/621e18f3-bde7-391f-1864-c46981a8079a%40bristle.com. For more options, visit https://groups.google.com/d/optout. |
- Restricting the user from closing the browser tab so that t... Rahul Paul
- Re: Restricting the user from closing the browser tab ... Melvyn Sopacua
- Re: Restricting the user from closing the browser tab ... Fred Stluka