Click to See Complete Forum and Search --> : safari...?


dovile
04-30-2003, 08:46 AM
May be someone know, how i can comunitate new browser from Mac -"safari"? I mean wich basics use this broser, how i can check this? This is my browserCheck for IE und Ns for PC und Mac :

var browser = "?";
function browserCheck(else_url)
{
if (document.all && document.getElementById) browser = "ie5"; // ie6 und opera5
else
if (document.all) browser = "ie4";
else
if (document.getElementById) browser = "ns6";
else
if (document.layers)
browser = "ns4";
else
location.href = else_url;
//alert("check: " + browser);
if (browser == "ie5" )
{
return true;
}
else return false;
}


var mac = "?";
function macCheck()
{

if ((navigator.appVersion.indexOf("Win") != -1))
{ mac="no";
}else{ mac="yes";}
}

.........

How i can do it for Safary?

Kind regards -Dovile:confused:

khalidali63
04-30-2003, 09:19 AM
you should be able to do this

alert(Browser name string = "+navigator.userAgent)
it gives the full string then you can easily write detection from it.

BTW
if(document.getElementById) will be true in NS6+ and IE5+ case too to make sure its NS6+ browsers you have to do
if(!document.all && document.getElementById)

joer
06-15-2004, 10:14 PM
Do you know where I can find documentation on safari javascript?

dovile
06-16-2004, 02:30 AM
hello joer,

between i have found sefl logical way to use java script for safary.
Im sure it is more elegace posibilitys to write the script, but it works, so im glad for the moment ;)) The offitial descriptions for this NEW browser- i have not found, but in comunication with my clients i have checked what i can use, what not... so check for the browsers and function (im using this for CCS):

//browser check

var browser = "?";
function browserCheck(else_url)
{
if (document.all && document.getElementById) browser = "ie5"; // ie6 und opera5
else
if (document.all) browser = "ie4";
else
if (document.getElementById) browser = "ns6";
else
if (document.layers)
browser = "ns4";
else
location.href = else_url;
//alert("check: " + browser);


if (browser == "ie5" )
{
return true;
}
else return false;
}


var mac = "?";
function macCheck()
{

if ((navigator.appVersion.indexOf("Win") != -1))
{ mac="nein";
}else{ mac="ja";}
}

// how you can see browser check is the same,
//just next script for that is desiding:

//CSS "switch filter"

browserCheck();
macCheck();

if ( mac =="ja" )
{
if (browser=="ns4")
{
document.write("<LINK REL=\"STYLESHEET\" HREF=\"technik/CSS/mac_ns.css\" TYPE=\"text/css\">"); // css doc for mac Browser NS4
}
else if (browser=="ie5" )
{
document.write("<LINK REL=\"STYLESHEET\" HREF=\"technik/CSS/mac_ie5.css\" TYPE=\"text/css\">"); // css doc for mac Browser IE5
}
else
{
document.write("<LINK REL=\"STYLESHEET\" HREF=\"technik/CSS/mac_saf.css\" TYPE=\"text/css\">"); // css doc for mac all other Browsers
}
}
else
{
if (browser=="ns4")
{
document.write("<LINK REL=\"STYLESHEET\" HREF=\"technik/CSS/win_ns.css\" TYPE=\"text/css\">"); // css doc for windows Browser NS4
}
else
{
document.write("<LINK REL=\"STYLESHEET\" HREF=\"technik/CSS/win_ie5.css\" TYPE=\"text/css\">"); // css doc for windows Browser IE5 and all other browsers and systems
}

}

// script end -------------------------------------------------



So i hope you can use it.

Best regards- dovile

joer
06-16-2004, 10:05 PM
Hi doville:

Thanks for you reply. I do know how to detect safari using the khtml rendering engine way. My problem isnt with safari detection, but with focusing of popup window when user tries to clikc on parent window. I have script that works in all browsers except safari, where if user tries to click on parent window, the focus comes back to popup unless they close popup using close button or clicking on x box in right. I wasn't sure if there is some new security issue in safari 1.2 that prevents the ability to control a popup's focus.

dovile
06-17-2004, 02:29 AM
I can't realy answer you :/ Im sorry. one what i can do- to ask in german forum, may be there someone knows something about. One would be usefull, if you could me send your script, then i could get idea about im talking.

best regards - dovile

dovile
06-17-2004, 02:53 AM
i have found one site, with informations for window scripting. There it is explaned what you can use for different browsers, so may be youll find some usefull infromation :)

http://www.quirksmode.org/js/croswin.html

best regards - dovile