Page 1 of 1
Include file unless Opera 7?
Posted: Thu May 10, 2007 6:45 pm
by JAB Creations
This was my attempt but go figure, it does not work...
Code: Select all
$useragent = $_SERVER['HTTP_USER_AGENT'];
if (!eregi("Opera/7") || !eregi("Opera 7")) {include("includes-noscript.php");}
Posted: Thu May 10, 2007 6:56 pm
by nickvd
Is it really worth supporting the .001% that are still using Opera 7?
Edit: You're not testing your regex against anything....
Posted: Thu May 10, 2007 7:00 pm
by JAB Creations
The shares of people using Opera 7 are off-topic to this thread.
Posted: Thu May 10, 2007 7:01 pm
by volka
You passed only the pattern but not the subject to ereg().
You want it to not match
Opera/7 and to not match
Opera 7 -> !ereg() && !ereg()
You could use a pattern but you didn't. The pattern would be: Opera
/ or space 7
ereg is deprecated, use preg_match instead.
try
Code: Select all
if ( !preg_match('!Opera[/\s]7!', $_SERVER['HTTP_USER_AGENT']) ) {
require 'includes-noscript.php';
}
Posted: Thu May 10, 2007 7:10 pm
by JAB Creations
Thank you volka, this works great!
My site works great in Opera 7+, works good enough in Opera 4/5, and only currently has a menu issue with absolute positioning in Opera 3.
Posted: Thu May 10, 2007 7:13 pm
by volka
Posted: Thu May 10, 2007 7:57 pm
by RobertGonzalez
I have a little code snippet in either coding critique or code snippets that might be helpful to you as well. If not, there is always phpSniff.
Posted: Thu May 10, 2007 9:09 pm
by JAB Creations
Thanks Everah, go ahead and post it or message it (whichever is fine). I'm dealing with such specific issues that scripts don't usually help but I'll still take a look.

Posted: Thu May 10, 2007 9:16 pm
by John Cartwright
Don't be lazy JAB, using the search function you'll be able to find it in 10 seconds.
Posted: Fri May 11, 2007 1:03 pm
by JAB Creations
Oh well I've got all the issues on my mind browser-related covered thus far. I just have to document what I've done to deal with those issues. Thanks though...