Is there any way or script to open my site only in Chrome browser and not open in any other browser ?
Is there any way or script to open my site only in Chrome browser and not open in any other browser?
Asked
Active
Viewed 216 times
-2
-
What do you mean "open"? If someone googles your site in Firefox and clicks the link, what do you expect to happen? – Clonkex Jul 17 '17 at 05:21
-
simple and sweet - I want my site to just work in chrome browser and for rest browser will display some message like "This site is only work in Chrome browser" (something like this). – Nikhil Vaghela Jul 17 '17 at 05:25
-
Thanks @Clonkex, May be this work. – Nikhil Vaghela Jul 17 '17 at 05:34
1 Answers
0
Before ask question please google it, Php : Finding Chrome and Safari Browsers
$user_agent = $_SERVER['HTTP_USER_AGENT'];
if (preg_match('/MSIE/i', $user_agent)) {
echo "Internet Explorer";
}elseif (preg_match('/Firefox/i', $user_agent)) {
echo "FireFox";
}elseif (strpos( $user_agent, 'Chrome') !== false)
{
echo "Google Chrome";
}elseif (strpos( $user_agent, 'Safari') !== false)
{
echo "Safari";
}elseif (preg_match('/Opera/i', $user_agent)) {
echo "Opera";
}

aidinMC
- 1,415
- 3
- 18
- 35