Jump to content

[SOLVED] Question


php?

Recommended Posts

Okay... so i looked that over and for the message prompt that i want ... how would I make it so that if the browser is not Firefox it displays a command prompt.

 

// test for Firefox
        }elseif(eregi("Firefox", $agent)){
            $bd['browser']="Firefox";
            $val = stristr($agent, "Firefox");
            $val = explode("/",$val);
            $bd['version'] = $val[1];

Link to comment
Share on other sites

I would want it to be a simple message when they visit the website it checks if their browser is firefox... and if not it displays a little message that says to ensure better performance please use firefox as your browser. An example of the message would be like the one where if you close firefox with more then 1 tab open then it displays a little warning message

Link to comment
Share on other sites

This should work (complete code, also checks for browser):

 

<?php
if (!strpos($_SERVER['HTTP_USER_AGENT'], 'Firefox')) {
echo '<script type="text/javascript">
alert("Please use Firefox bla bla bla");
</script>';
}
?>

 

EDIT: Think it would be better to add it as an onload event (so the page doesn't keep trying to load in the background while the alert box is open). Like:

 

<body<?php
if (!strpos($_SERVER['HTTP_USER_AGENT'], 'Firefox')) {
echo ' onload="alert(\'Please use Firefox bla bla bla\');"';
}
?>>

 

2nd edit: Removed the unnecessary "window." bit from the javascript.

Link to comment
Share on other sites

who moved this thread

 

Is that a question? Your missing the question mark.

 

I moved it. This entire problem is best handled via Javascript.

 

no it's not; when PHP is involved - the thread should have remained in the PHP forum (but that's ok; pretty much the same thread was re-posted in the PHP forum and I solved the thread there - haha - looks like you deleted that thread also - someones abusing the moderator powers - that's ok - I know I solved it in the PHP forum - haha) and I did not need a question mark - note the emoticon (3 question marks above the head - I think that was sufficient enough to show unknowing and/or a question was being asked). :P

Link to comment
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.