This sounds like a bug to me although I have not tested it myself. Try opening case with support on this.
The other way would be to look for sforce.one context variable using JavaScript .Inside lightning experience context variable Sforce will be true.
var isSF1=isSF1 = typeof sforce ===!== 'undefined'?false:true;'undefined';