My default unicode font doesnot work properly on Safari running on Mac computers. So I would like to load different style sheet theme if the browser is safari running on mac. Any help is much appreciated. I would also like to know how to change the font-face
declaration (for eot files) on the master pages depending on the browser.
// This script sets OSName variable as follows:
// "Windows" for all versions of Windows
// "MacOS" for all versions of Macintosh OS
// "Linux" for all versions of Linux
// "UNIX" for all other UNIX flavors
// "Unknown OS" indicates failure to detect the OS
var OSName="Unknown OS";
if (navigator.appVersion.indexOf("Win")!=-1) OSName="Windows";
if (navigator.appVersion.indexOf("Mac")!=-1) OSName="MacOS";
if (navigator.appVersion.indexOf("X11")!=-1) OSName="UNIX";
if (navigator.appVersion.indexOf("Linux")!=-1) OSName="Linux";
// Get browser info:
Var Browser = navigator.appCodeName;
if (OSName == "MacOs" && Browser == "Safari" ) {
document.write('Your style sheet here');
}
I forgot to mention, I like jprochazka's approach first. If you can resolve the font issue and work with one stylesheet (or at least stylesheet set) , that's better and easier than producing another stylesheet just for that browser.
kjshaju
Member
131 Points
80 Posts
How to load a different style sheet theme if the browser is Safari running on Mac computers?
Apr 18, 2012 09:48 PM|LINK
My default unicode font doesnot work properly on Safari running on Mac computers. So I would like to load different style sheet theme if the browser is safari running on mac. Any help is much appreciated. I would also like to know how to change the font-face declaration (for eot files) on the master pages depending on the browser.
jprochazka
Contributor
4992 Points
748 Posts
Re: How to load a different style sheet theme if the browser is Safari running on Mac computers?
Apr 18, 2012 10:05 PM|LINK
If you are having @font-face cross browser support issues try running your font through this generator:
http://www.fontsquirrel.com/fontface/generator
For the CSS something like so:
@font-face { font-family: 'Comfortaa Regular'; src: url('Comfortaa.eot'); src: local('Comfortaa Regular'), local('Comfortaa'), url('Comfortaa.ttf') format('truetype'), url('Comfortaa.svg#font') format('svg'); }To apply the font in your CSS:
p { font-family: 'Comfortaa Regular', Helvetica, Arial, sans-serif; }Taken from http://blog.themeforest.net/tutorials/how-to-achieve-cross-browser-font-face-support/.
BlogDog
Member
456 Points
333 Posts
Re: How to load a different style sheet theme if the browser is Safari running on Mac computers?
Apr 19, 2012 04:57 AM|LINK
request.browser
http://msdn.microsoft.com/en-us/library/3yekbd5b.aspx
riak
Member
268 Points
90 Posts
Re: How to load a different style sheet theme if the browser is Safari running on Mac computers?
Apr 19, 2012 05:24 AM|LINK
See if this will help you:
// This script sets OSName variable as follows: // "Windows" for all versions of Windows // "MacOS" for all versions of Macintosh OS // "Linux" for all versions of Linux // "UNIX" for all other UNIX flavors // "Unknown OS" indicates failure to detect the OS var OSName="Unknown OS"; if (navigator.appVersion.indexOf("Win")!=-1) OSName="Windows"; if (navigator.appVersion.indexOf("Mac")!=-1) OSName="MacOS"; if (navigator.appVersion.indexOf("X11")!=-1) OSName="UNIX"; if (navigator.appVersion.indexOf("Linux")!=-1) OSName="Linux"; // Get browser info: Var Browser = navigator.appCodeName; if (OSName == "MacOs" && Browser == "Safari" ) { document.write('Your style sheet here'); }BlogDog
Member
456 Points
333 Posts
Re: How to load a different style sheet theme if the browser is Safari running on Mac computers?
Apr 19, 2012 04:48 PM|LINK
I forgot to mention, I like jprochazka's approach first. If you can resolve the font issue and work with one stylesheet (or at least stylesheet set) , that's better and easier than producing another stylesheet just for that browser.