1

i'm working in a dnn6 portal and use this code in my skinpage.ascx. but it does not load the SafariSkin.css.

     <!--[if Safari]>
     <link href="SafariSkin.css" rel="stylesheet" type="text/css" />
     <![endif]-->

     <!--[if !Safari]>
     <link href="Skin.css" rel="stylesheet" type="text/css" />
     <![endif]-->

but if i change the condition to "IE" it works. WHY?

i also use the following code in:

     <dnn:STYLES runat="server" ID="Stylesnotsafari" Name="notsafari" StyleSheet="SafariSkin.css" Condition="Safari" UseSkinPath="true"/>

and again just when the condition is IE it works properly. Any Idea??

what should i do to have "safari" condition???

maryam mohammadi
  • 694
  • 3
  • 14
  • 27

2 Answers2

2

Since you're in ascx file you can use server code to determine the browser.

<link href="<%= Request.Browser.Browser == "Safari" ? "SafariSkin.css" : "NotSafari.css" %>" rel="stylesheet" type="text/css" />

For this to work, make sure the language of the skin is C# (first line, where it says language="vb", change to language="c#"), or modify the code to above to VB.net.

Also, for older version of .NET the Safari browser is not correctly identified. If that's the case, read more, for example at http://www.velocityreviews.com/forums/t119465-asp-net-2-0-vs-safari-browser.html to update the browser detection manually.

Bogdan Litescu
  • 845
  • 8
  • 8
0

Safari cannot be targeted in the same way that IE can through conditionals.

There are some hacks that may work within your standard stylesheet, but really you would be best served by adjusting your html/css in a way that will support Safari (a task which is typically far less labor-intensive than it is in IE).

Community
  • 1
  • 1
Craigjb
  • 107
  • 1
  • 1
  • 12