Safari JavaScript prompt() cancel
The method to detect when a user click on cancel in a prompt window doesn't work in safari (and only safari). It returns an empty string instead of null.
The following code works but it won't make the difference between a user who cancel and a user who send an empty string !
Code:
var text = prompt('message','')
if (text != null && text.trim() != '') { // ?
console.log(text)
} else {
console.log('No text')
}
Do you know a simple method to detect when a user click on cancel ?
P.S: I'm french so please don't use complicate word
Safari-OTHER, OS X El Capitan (10.11.5), null