I know we can bind a function to bootstrap modal for close event like this:
//run the script
But this only works when you close the modal by clicking on grey area or clicking on close button in firefox. However whenever I try to close the modal by ESC key my script is running. I don't want to disable to ESC key for closing bootstrap modal.
Is there any solution to detect closing modal by pressing escape in bootstrap in firefox?
You can check a sample
. In this example In firefox if you play the YouTube video in the modal with and close the modal by pressing escape the video doesn't stop but if you click on close button or click on grey area then the close functions works properly and clear the iframe src so video stops.