PDA

View Full Version : Display a message to Opera and Safari Users



Luke
07-09-2008, 07:48 PM
Hii

I'm developing a site, an di've just tested it in Opera and Safari,
In Opera, the scripts don't work so site litterally doesn't work lol
and in Safari it works but font is weird lol.

So is there a way i can make some text come up if they're using any of those browsers to recomend they use IE, FF oR GC?

Thanks
Luke

Calon
07-09-2008, 07:56 PM
<script>

//Browser redirect Script- © Dynamic Drive (www.dynamicdrive.com)
//For full source code, 100's more DHTML scripts, and Terms Of Use,
//visit dynamicdrive.com

var browser_type=navigator.appName
var browser_version=parseInt(navigator.appVersion)

//if NS 6
if (browser_type=="Netscape"&&browser_version>=5)
window.location.replace("http://mozilla.org")
//if IE 4+
else if (browser_type=="Microsoft Internet Explorer"&&browser_version>=4)
window.location.replace("http://microsoft.com")
//if NS4+
else if (browser_type=="Netscape"&&browser_version>=4)
window.location.replace("http://www.netscape.com")
//Default goto page (NOT NS 4+ and NOT IE 4+)
else
window.location="http://www.dynamicdrive.com"
</script>


Edit that :)

TheProtege
07-09-2008, 08:52 PM
<script>

//Browser redirect Script- © Dynamic Drive (www.dynamicdrive.com)
//For full source code, 100's more DHTML scripts, and Terms Of Use,
//visit dynamicdrive.com

var browser_type=navigator.appName
var browser_version=parseInt(navigator.appVersion)

//if NS 6
if (browser_type=="Netscape"&&browser_version>=5)
window.location.replace("http://mozilla.org")
//if IE 4+
else if (browser_type=="Microsoft Internet Explorer"&&browser_version>=4)
window.location.replace("http://microsoft.com")
//if NS4+
else if (browser_type=="Netscape"&&browser_version>=4)
window.location.replace("http://www.netscape.com")
//Default goto page (NOT NS 4+ and NOT IE 4+)
else
window.location="http://www.dynamicdrive.com"
</script>
Edit that :)

What if JS is turned off....

Ask someone to make a PHP file, grabbing HTTP_USER_AGENT, then say for me, it return "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1.", you can see im using Firefox, version 3.0.1.

Im in bed, so I cba to code. :P

Luke
08-09-2008, 01:52 PM
hmm, could you maybe code it when your out of bed please (+rep xD), as i'm having trouble understanding that.

At above, thanks for trying but ye, javascript is the problem in the first place :(

Robbie
08-09-2008, 03:53 PM
<?php
$agent = $_SERVER["HTTP_USER_AGENT"];

if(eregi('Opera', $agent)) {
echo("You are using Opera");
}

if(eregi('Firefox', $agent)) {
echo("You are using Firefox");
}
?>

Mirkwood
09-09-2008, 05:24 AM
Why not just develop the site to work in Opera, I wouldn't change browsers just to browse a site, and what about text-only browsers, you should make your website accessible to everyone.

Want to hide these adverts? Register an account for free!