Jump to content
xisto Community
abhiram

A Message To Visitors Who Use Ie PHP script to use on your site

Recommended Posts

I found a very neat PHP script which will show a message to people who use IE only. It doesn't show anything if you use any other browser ;).

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 B).

Share this post


Link to post
Share on other sites

This was the code taken from that link:

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:

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

Share this post


Link to post
Share on other sites

Putting something like that on a website is a double-edged sword. On one hand, you're spreading the word on Firefox and why it's a better alternative browser to IE. On the other hand, your basically telling any IE users who visit your site that they'll just be annoyed with that message every time they visit your site. It runs the potential risk of getting people to not switch to Firefox but rather to avoid your site like the plague. =^^=

 

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. =^^=

Share this post


Link to post
Share on other sites

You could also do this with css:

First, the html 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):
#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.

Share this post


Link to post
Share on other sites

lol make the message on your website display "Internet Explorer is a horrible, peice of crap web browser. If you do not switch to firefox you are an idiot. here is the download link. https://www.mozilla.org/en-US/firefox/new/ Firefox does things 100x better than crappy Internet Explorer. Try it and find out for yourself what youve been missing out." I know thts long but thts wut i'm going to use because people need to know tht they have to get rid of IE. And when they get firefox, they will "Rediscover the web". That is the truth.

Share this post


Link to post
Share on other sites

You got to remember that not all people can change their borwser. They might not have the skills to install software, they are scared of downloading new software or simple they are not allowed to: you usually cannot install new software on that office PC. 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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.