|
|
A Message To Visitors Who Use Ie - PHP script to use on your site | ||
Discussion by abhiram with 8 Replies.
Last Update: March 7, 2006, 5:45 am | |||
Here's the source.
I've used it on my site already. If anyone is interested to see it in action, just click on my sig and check it out in IE
Fri Feb 17, 2006 Reply New Discussion
CODE
if(eregi('MSIE', $_SERVER['HTTP_USER_AGENT'])){
echo '<div>
Bla Bla Bla your text explaining why people should switch to Firefox.
</div>';
}
This is how I would write it:
CODE
if(strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'msie')){
echo '<p>Blah blah blah your text...</p>';
}
There's other ways to do it, but I think it's overkill using eregi, which is the case insensitive regular expression function, preg_match is quicker than ereg. However I find strpos to be faster than both these, and all it returns is the position it found the string you were looking for, if the string however is the first element, it will not work, because position will be 0 and considered false.
Cheers,
MC
Fri Feb 17, 2006 Reply New Discussion
Fri Feb 17, 2006 Reply New Discussion
Fri Feb 17, 2006 Reply New Discussion
On the plus side, I like how this message is a lot more subtle than the pop-ups that used to be so frequent in the past. =^^=
Sat Feb 18, 2006 Reply New Discussion
First, the html code:
CODE
<p id="firefox">This site will self destruct in 10 seconds if you don't get Firefox</p>Now, the css code (could be embedded or included in an external file):
CODE
#firefox {
display: none;
}
* html #firefox {
display: inline;
}
Every css-capable browser would pick up the first style, which would hide the paragraph with the "firefox" id. Then, in the next style, since the extra asterisk makes the css invalid to Firefox (and possibly many other browsers), Firefox will ignore it and keep the paragraph invisible. But since IE is so weird and still accepts the second style, it'll change the paragraph back to visible.
Sat Feb 18, 2006 Reply New Discussion
QUOTE
IE is so weirdYou're so right about that. That's a pretty neat idea as well
Sat Feb 18, 2006 Reply New Discussion
Tue Mar 7, 2006 Reply New Discussion
I don't like IE, and I'd like to educate people to change their browser. I used to have that kind of warning for IE but I decided later that it's not that cool. I bet it annoyed more people than it converted. Instead now I have Firefox and Opera download logos on the bottom of my site. They don't get on people's face but some people will notice them and undestand that I recommend these browsers and that my site functions well with these browsers.
Tue Mar 7, 2006 Reply New Discussion
Team Space (6)
|
(1) Blogger.com Hack - Is There A Way To Categorize All The Posts In A Single Blog
|
Index




