Is there any way that I can close left panel when user click back button (previous page)?
I assume that a JS function is called, when the back button on the device is pressed, correct?
If so:
- check if the panel is open (app.panel.left.opened===true)
- if so, close panel (app.panel.close())
Or just call aways (app.panel.closed()). Response is true if a panel was open.
1 Like
But if I click back button (or the previous page button) in my mobile browser, it will automatically go back to previous page.
How should I close the panel without going back to previous page?
Maybe this helps:
window.onbeforeunload = function() { return “Your work will be lost.”; };
I’ve tried. Every time user clicked ‘back’ button to close the panel, the alert shows up.
Thanks.
I’m not sure if it works, but I’ll try adding another page and use pushState.