I was using a simple regex test like
is_safari_or_uiwebview = /(iPhone|iPod|iPad).*AppleWebKit/i.test(navigator.userAgent);
in my js. After compile it with Closure compiler (advanced optimization) it's not working anymore. It still give me the regex but navigator.useragent is missing.
Note, I'm not using closure library and do no intent to use at this point. How can I preserve this test?
js code
var browser_type = new RegExp('(iPhone|iPod|iPad).*AppleWebKit', 'i');
function is_safari_or_uiwebview() {
return browser_type.test(navigator.userAgent);
}
window['is_safari_or_uiwebview'] = is_safari_or_uiwebview;
compiled code:
var l=/(iPhone|iPod|iPad).*AppleWebKit/i,l=/(iPhone|iPod|iPad).*AppleWebKit/i;function m(){return l.test(navigator.c)}window.is_safari_or_uiwebview=m;