javascript - user browser detecting information in php
I am trying for the long time to search the function that help to find the user browser name. I did my best but not any solution.
If there is not function so tell me How I can send this javascript value to email.
I try to send the a lot of time but it goes in this form userbrowser
while userbroswer should be chrome or something else. I try to use this on Local server without mail it's showing well but when it goes to mail it shows the script instead of information.
Code of js here:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
``<script type="text/javascript">
$browsers = ["Firefox", "Chrome", "Safari", "Opera",
"MSIE", "Trident", "Edge"];
$userbrowser
$useragent = navigator.userAgent;
for (var i = 0; i < browsers.length; i++) {
if( useragent.indexOf(browsers[i]) > -1 ) {
userbrowser = browsers[i];
break;
}
};
switch(userbrowser) {
case 'MSIE':
userbrowser = 'Internet Explorer';
break;
case 'Trident':
userbrowser = 'Internet Explorer';
break;
case 'Edge':
userbrowser = 'Internet Explorer';
break;
}
</script>
Answer
Solution:
for browser Detection, we use
navigator.appName
andnavigator.appVersion
.navigator.appName
detects the web browser andnavigator.appVersion
describes the browser version.People are also looking for solutions of the problem: your lock file does not contain a compatible set of packages. please run composer update
Source
Share
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.