cometchat / chat-sdk-javascript

Voice & Video Calling and Text Chat SDK for JavaScript/Web
Other
30 stars 24 forks source link

Interacting with video components results in "unsaved changes" dialog in chrome #82

Closed joeyslack closed 6 months ago

joeyslack commented 3 years ago

Chrome prompts "Changes you made may not be saved" via dialog when navigating away from a video call. This happens after interacting with any video setting. I do not wish to click additional chrome dialogs due to the way your video application behaves, using global event listeners. I want to prevent our users from being nagged with ugly chrome dialogs. Furthermore, this creates an additional step for a user to interact with, blocking them from navigation away from the video page.

To reproduce:

  1. Host a video chat
  2. Load your camera
  3. Interact with any setting, via any button (such as changing audio device)
  4. Navigate away to another site

This seems to be related to the way you attach a global beforeunload handler to the window object when cometchat loads in it's frame. Chrome presents this dialog as a means of protection against the session data that's being manipulated there.

As such, your code:

P.beforeUnload = function(e) {
  var t = P.getDataFromSessionStorage(L.SESSION_STORE.SESSION_ID);
  P.removeDataFromSessionStorage(L.SESSION_STORE.SESSION_ID), 
  C.LocalStorage.getInstance().set(L.SESSION_STORE.SESSION_ID, t)
}

This event's default behavior needs to be overwritten, nullified, or returned false.

I can solve this situation by implementing my own webRTC solution, however to continue to use cometchat as a hosted solution, I expect this to be resolved gracefully. Please do not nag my users when they try to navigate away from the site after interacting with video options.

Thank you.

Let me know if you'd accept my pull request if you cannot solve this.

proveshapyne commented 3 years ago

Hey @joeyslack,

I have reached out to you via email regarding this issue. I am closing out this ticket and we can stay connected there. Thank you.

Regards, Provesha