I want my php website to open only on internet-explorer while it shouldnt open on other browsers and also display message to them to view website on internet-explorer
i have tried this code below but it only displays message on updating the browsers
<script>
var $buoop = {required:
{e:-4,f:-3,o:-3,s:-1,c:-3},insecure:true,api:2019.10 };
function $buo_f(){
v ar e = document.createElement("script");
e.src = "//browser-update.org/update.min.js";
document.body.appendChild(e);
};
try {document.addEventListener("DOMContentLoaded",
$buo_f,false)}
catch(e){window.attachEvent("onload", $buo_f)}
</script>
Try this
$this->load->library('user_agent');
if ($this->agent->browser() != 'Internet Explorer'){
echo "browser not supported";
}
if you wan to do this by JS than try this..
if((navigator.userAgent.indexOf("MSIE") != -1 ) || (!!document.documentMode == true )) //IF IE > 10
{
alert('EI');
}else{
alert('noooooo');
}
here is a js code where you can identify any browser and based on that you can display your page
// Opera 8.0+
var isOpera = (!!window.opr && !!opr.addons) || !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0;
// Firefox 1.0+
var isFirefox = typeof InstallTrigger !== 'undefined';
// Safari 3.0+ "[object HTMLElementConstructor]"
var isSafari = /constructor/i.test(window.HTMLElement) || (function (p) { return p.toString() === "[object SafariRemoteNotification]"; })(!window['safari'] || (typeof safari !== 'undefined' && safari.pushNotification));
// Chrome 1 - 71
var isChrome = !!window.chrome && (!!window.chrome.webstore || !!window.chrome.runtime);
// Blink engine detection
var isBlink = (isChrome || isOpera) && !!window.CSS;
-------------------------
// Internet Explorer 6-11
var isIE = /*@cc_on!@*/false || !!document.documentMode;
// Edge 20+
var isEdge = !isIE && !!window.StyleMedia;
if(isIE){
//show body
}else{
//show message
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.