123dhs321
02-05-2005, 12:46 AM
I have a form that works great on all browers except for Safari. I've narrowed it down to be a margin value that needs to be
"margin: 0;" for Safari
and "margin: -17px 0 0 0;" for everything else.
Anyone know of a hack that only Safari sees?
ps The safari version is the latest version.
rmedek
02-05-2005, 01:37 AM
There are a few, but the trouble is then Moz also gets the brush off... There was a thread on this not too long ago:
http://www.codingforums.com/showthread.php?t=47567
Hope it helps,
whizard
02-05-2005, 05:11 AM
You could use some javascript, along with two css files, ine for safari, one for everyone else:
var safari = false;
var agent = navigator.userAgent.toLowerCase();
if (agent.indexOf("safari") != -1){
//code to show Safari Stylesheet
}
else{
//Code to show everybody else's stylesheet
}
Good Luck, Dan
rmedek
02-05-2005, 05:17 AM
Looks like that won't work, but close...
http://codingforums.com/showthread.php?p=271374#post271374
123dhs321
02-05-2005, 07:01 PM
Dan,
It worked perfectly. How would I add Opera to this script? Opera does the same thing as Safari....
<script language="javascript">
<!--
var safari = false;
var agent = navigator.userAgent.toLowerCase();
if (agent.indexOf("safari") != -1){
//code to show Safari Stylesheet
document.write('<link rel="stylesheet" type="text/css" href="css/safari.css" \/>');
}
else{
//Code to show everybody else's stylesheet
document.write('<link rel="stylesheet" type="text/css" href="css/screen.css" \/>');
}
//-->
</script>
whizard
02-06-2005, 01:33 AM
It worked perfectly. How would I add Opera to this script? Opera does the same thing as Safari....
here is the code which will handle both opera and safari:
<script language="javascript">
<!--
var safari = false;
var opera = false;
var agent = navigator.userAgent.toLowerCase();
if (agent.indexOf("safari") != -1){
//code to show Safari Stylesheet
document.write('<link rel="stylesheet" type="text/css" href="css/safari.css" \/>');
}
else if(agent.indexOf("opera") != -1){
//code to show Opera Stylesheet
document.write('<link rel="stylesheet" type="text/css" href="css/opera.css" \/>');
}
else{
//Code to show everybody else's stylesheet
document.write('<link rel="stylesheet" type="text/css" href="css/screen.css" \/>');
}
//-->
</script>
good luck, dan
brothercake
02-06-2005, 02:01 PM
You could use some javascript, along with two css files, ine for safari, one for everyone else:
That won't reliably work - Safari doesn't always have "safari" in its UA string.
You'd be better off trying to find a CSS solution that works in Safari and Opera in the first place. Have you got a demo of the problem?
sjames0077
05-24-2011, 02:45 PM
LOVE the css javascript thanks so much guys !
<script language="javascript">
<!--
var safari = false;
var agent = navigator.userAgent.toLowerCase();
if (agent.indexOf("safari") != -1){
//code to show Safari Stylesheet
document.write('<link rel="stylesheet" type="text/css" href="css/safari.css" \/>');
}
else{
//Code to show everybody else's stylesheet
document.write('<link rel="stylesheet" type="text/css" href="css/css.css" \/>');
}
//-->
</script>