This code worked for me.
If you have experience fragment and want to check wcmmode on non-experience fragment page and you want to make everything work properly in edit mode, with ?wcmmode=disabled and without ?wcmmode( Live Url), then -
function getCookie(name) {
var dc = document.cookie;
var prefix = name + "=";
var begin = dc.indexOf("; " + prefix);
if (begin == -1) {
begin = dc.indexOf(prefix);
if (begin != 0) return null;
}
else
{
begin += 2;
var end = document.cookie.indexOf(";", begin);
if (end == -1) {
end = dc.length;
}
}
return decodeURI(dc.substring(begin + prefix.length, end));
}
var myCookie = getCookie("wcmmode");
var params = window.location.search;
if( myCookie=='preview' || params=='?wcmmode=disabled' || myCookie==null){
// DISABLE MODE
}