wdlsvnit / Omeclone

A clone of omegle.com
104 stars 50 forks source link

Show confirmation modal when user reloads page. #124

Closed AdityaHirapara closed 6 years ago

AdityaHirapara commented 6 years ago

Current behaviour Chat ends without confirmation when user reloads page.

Expected behaviour Confirmation modal should be shown on reloading of page.

ajayns commented 6 years ago

Rather than a confirmation modal, shouldn't it remain on the same chat if the user reloads? In case user navigates back or so then it's required to a show an alert.

lunaticmonk commented 6 years ago

To keep the user on the same page, we need to store the messages, right? Because we aren't using any backend stuff here, we need to figure out something.

On Mar 30, 2018 7:41 PM, "Ajay NS" notifications@github.com wrote:

Rather than a confirmation modal, shouldn't it remain on the same chat if the user reloads? In case user navigates back or so then it's required to a show an alert.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/wdlsvnit/Omeclone/issues/124#issuecomment-377532634, or mute the thread https://github.com/notifications/unsubscribe-auth/ARGGJal2ZMnL4P_y98BB2-yzGIScN7z-ks5tjj0sgaJpZM4SpG0Y .

ajayns commented 6 years ago

Storing messages is not a good option. So I'd say we'll just have to go with an alert in case the user decides to do any navigation at all or hits refresh.

@AdityaHirapara The window.onbeforeunload event can be used to define a function with calls when user. I'm not sure about browser compatibility though.

AdityaHirapara commented 6 years ago

@ajayns windows.onbeforeunload is not even compatible with chrome, So we can't use it.

lunaticmonk commented 6 years ago

We discussed it yesterday too. We haven't implemented just because of browser compatibility. If we want to implement the form resubmission like thing, then we need to change the bottom input to form. Aditya we tried form thing too. Right? What was the problem with that?

On Mar 30, 2018 10:03 PM, "Aditya Hirapara" notifications@github.com wrote:

@ajayns https://github.com/ajayns windows.onbeforeunload is not even compatible with chrome, So we can't use it.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/wdlsvnit/Omeclone/issues/124#issuecomment-377564509, or mute the thread https://github.com/notifications/unsubscribe-auth/ARGGJQcCTW5GpeikxckPjWYqQZBwiHNiks5tjl53gaJpZM4SpG0Y .

AdityaHirapara commented 6 years ago

@sumedh123 In form, when we send message, it will reload page and chat will end.

lunaticmonk commented 6 years ago

we can prevent the default action right? @AdityaHirapa.

AdityaHirapara commented 6 years ago

@sumedh123, Then it will prevent that "resubmission" alert too

ajayns commented 6 years ago

@AdityaHirapara preventDefault() does that?

And chrome for me seems to show "Do you want to leave this site" irrespective of return message we put in the function. Isn't that fine for now? (Talking about onbeforeload here)

lunaticmonk commented 6 years ago

Yeah we need a MVP(Minimum viable product) for now.

lunaticmonk commented 6 years ago

For now, it's better to have something than nothing. Let's implement the discussed one then.