Jump to content

firefox only


nashsaint

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.