Jump to content

Recommended Posts

A simple way would be to put this at the top of your code:

 

<?php
if (!strpos($_SERVER['HTTP_USER_AGENT'], 'Firefox')) {echo 'Viewable with Firefox only!'; exit;}
?>

 

But remember that tech savvy users can alter the user agent string to anything they want, so it will not keep those from seeing your page in other browsers. It should stop most people though.

Link to comment
https://forums.phpfreaks.com/topic/106423-firefox-only/#findComment-545522
Share on other sites

Use something like this? :)

 

<?php

$useragent = $_SERVER['HTTP_USER_AGENT'];

if(!preg_match('|Firefox/([0-9\.]+)|',$useragent,$matched)) {
die("You must use firefox to view this page");
}

//Anything from now on will only be seen by firefox users.

?>

 

Edit: Sorry, didnt see your post BadBad ;)

Link to comment
https://forums.phpfreaks.com/topic/106423-firefox-only/#findComment-545523
Share on other sites

When I code (XHTML/CSS) I go for compatibility in Firefox and IE7. They're handling the code mostly the same (the IE team sure has improved with IE7, although there's still some CSS issues around). I know there's still a large group of IE6 users, but they're hopefully updating sooner or later.

 

My point is, along the lines of MadTechie's, that you shouldn't cut off all non-Firefox users, but try to keep up with the standards, and make your code work in at least IE7 and Firefox. But maybe you just wanted to play around with browser specific code. If so, fine, but my advice still applies :)

Link to comment
https://forums.phpfreaks.com/topic/106423-firefox-only/#findComment-545537
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.