Hi,

We are working on a django project in which we are developing a two way 
audio visual solution for the users. Now we have certain set of APIs that 
need to be called from JavaScript through ajax request when user ends the 
call through our end-call button. Some of these ajax calls are sequential 
i.e. based on result of one ajax call another ajax call is made.

Now our problem is if the user close the tab or browser using the cross 
button of tab or browser, then these APIs are not called and many of our 
functionalities does not work. Hence to solve this we were looking into the 
following options : 

1. Restricting the user from closing the tab or browser until the user 
clicks on end-call button and all functionalities related to ending the 
call is done.
2. Calling the APIs before the browser or tab close when user tries to 
close the browser or tab.
3. Opening our template as a modal so that we can modify the closing of 
modal to satisfy our use case.

First option is not possible since it poses security risks w.r.t. browser. 
Currently our web page is opening as new tab. We have tried opening the 
page as new window and hiding the menu bar, minimize/maximize and cross 
button, but we could not hide the cross button. 

We tried the second option using window.onbeforeunload and window.onunload 
feature of JavaScript window object, but we could not call the APIs.

We are now thinking of the third option, but here we are stuck as we are 
not sure if the template can be directly rendered as a modal from django 
views. 

Also our web page will have the following major components : 

* video tag, where 2-way A/V will play.
* iframe where we have another feature.
* chat section where communication happens through django channels.
* File upload and download feature.
* Many functionalities are based on API call hence many ajax request.

In short our web page will be heavy and will have a lot of javascript files 
to be loaded. So will we get the same efficiency with modal as we get with 
proper web page? What will be the limitation and if possible how we can 
render our template as modal?

Our main intention have the same flow when the user clicks the end-call 
button or close the tab or browser i.e. all the functionalities that are 
happening when end-call button is clicked, must also happen when the user 
close the tab or browser.

Please help me with resolving this issue. You can also provide options 
other then what we have considered. All suggestions are welcome.

Thank you.

-- 
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/c0aff7ca-137a-4b28-80ab-a246f35dd4df%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to