Posted on June 22, 2017, 9:01 am, by admin, under
javascript.
<script type="text/javascript"> if(/chrom(e|ium)/.test(navigator.userAgent.toLowerCase()) && location.protocol==’http:’) { alert(’Using current position in chrome restricted under http protocol’) } else if (/msie/.test(navigator.userAgent.toLowerCase())) { console.log("This browser is MSIE"); } else if (/firefox/.test(navigator.userAgent.toLowerCase())) { console.log("This browser is Firefox"); } </script>
Posted on August 6, 2015, 5:56 pm, by admin, under
javascript.
window.location.host or document.location.host : you’ll get sub.domain.com:8080 or sub.domain.com:80 window.location.hostname or document.location.hostname: you’ll get sub.domain.com window.location.protocol or document.location.protocol: you’ll get http: window.location.port or document.location.port: you’ll get 8080 or 80 window.location.origin or document.location.origin: you’ll get http://sub.domain.com *