Can Miva do web browser detection? It would be helpful. If not, would Toolkit be able to access something that could?
Announcement
Collapse
No announcement yet.
browser detection
Collapse
X
-
Re: browser detection
That requires client side scripting, ie javascript.Bill Weiland - Emporium Plus http://www.emporiumplus.com/store.mvc
Online Documentation http://www.emporiumplus.com/tk3/v3/doc.htm
Question http://www.emporiumplus.com/mivamodu...vc?Screen=SPTS
Facebook http://www.facebook.com/EmporiumPlus
Twitter http://twitter.com/emporiumplus
-
Re: browser detection
PHP can. example:
PHP Code:$navigator_user_agent = (isset($_SERVER['HTTP_USER_AGENT'])) ? strtolower($_SERVER['HTTP_USER_AGENT']) : '';
$safari = (stristr($navigator_user_agent, "safari")>-1) ? 1 : 0;
$ns6 = (stristr($navigator_user_agent, "netscape6")>-1) ? 1 : 0;
$ie5 = (stristr($navigator_user_agent, "msie")>-1) ? 1 : 0;
$mac = (stristr($navigator_user_agent, "mac")>-1) ? 1 : 0;
$windows = (stristr($navigator_user_agent, "windows")>-1) ? 1 : 0;
$ns7 = ((stristr($navigator_user_agent, "gecko")>-1) && (!$safari)) ? 1 : 0;
$ns4 = ((stristr($navigator_user_agent, "mozilla/4")>-1) && (!$ie5)) ? 1 : 0;
I wonder if it's possible to call a PHP script using toolkit and have the PHP script it return the $_SERVER['HTTP_USER_AGENT'] variable string then use Miva if/else with more toolkit to assign variablesLast edited by dreamingdigital; 08-19-07, 05:41 PM.Colin Puttick
Miva Web Developer @ Glendale Designs
Comment
-
Re: browser detection
there is a server variable 's.http_user_agent' that reports the same information. Shouldn't you be able to use IF 'xxxx' CIN s.http_user_agent' ? (Use it in mivascript often).Bruce Golub
Phosphor Media - "Your Success is our Business"
Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
phosphormedia.com
Comment
-
Re: browser detection
I tried this out recently, but it didn't work for me. (perhaps I was doing something wrong)
However, it seemed to work fine using Bill's WCW Toolkit V5 to pull the variable out and copy it into an accessible global variable called g.useragent :Code:<mvt:item name="toolkit" param="vassign|useragent|s.http_user_agent" /> &mvt:global:useragent;
Comment
-
Re: browser detection
try:
Code:&mvt:s:http_user_agent; <mvt:if expr="'mozilla' CIN s.http_user_agent"> Hey, its Mozilla </mvt:if>
Bruce Golub
Phosphor Media - "Your Success is our Business"
Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
phosphormedia.com
Comment
-
Re: browser detection
Originally posted by Bruce - PhosphorMediatry:
Code:&mvt:s:http_user_agent; <mvt:if expr="'mozilla' CIN s.http_user_agent"> Hey, its Mozilla </mvt:if>
But the testing of the variable appears to work fine.
I couldn't get it to print the variable when I first tried, too -that's what made me think that the variable was not available via Storemorph. Hence, I tried it with the Toolkit.
Is it just me, or does theCode:&mvt:s:http_user_agent;
Comment
-
Re: browser detection
Awesome. I love Toolkit. :)
This is what I have so far - it's not the greatest but it's simple. I'm sure somebody can make a rock awesome geeked out version.
Code:<mvt:comment>*** START Browser & OS Detect ***</mvt:comment> <mvt:item name="toolkit" param="vassign|http_user_agent|s.http_user_agent" /> <mvt:item name="toolkit" param="sassign|safari|0" /> <mvt:item name="toolkit" param="sassign|ie|0" /> <mvt:item name="toolkit" param="sassign|ie7|0" /> <mvt:item name="toolkit" param="sassign|ns7_ff|0" /> <mvt:item name="toolkit" param="sassign|ns4|0" /> <mvt:item name="toolkit" param="sassign|mac|0" /> <mvt:item name="toolkit" param="sassign|windows|0" /> <mvt:if expr=" 'safari' CIN g.http_user_agent "> <mvt:item name="toolkit" param="sassign|safari|1" /> </mvt:if> <mvt:if expr=" 'msie' CIN g.http_user_agent "> <mvt:item name="toolkit" param="sassign|ie|1" /> </mvt:if> <mvt:if expr=" 'msie 7' CIN g.http_user_agent "> <mvt:item name="toolkit" param="sassign|ie7|1" /> </mvt:if> <mvt:if expr=" 'gecko' CIN g.http_user_agent AND g.safari EQ '0' "> <mvt:item name="toolkit" param="sassign|ns7_ff|1" /> </mvt:if> <mvt:if expr=" 'mozilla/4' CIN g.http_user_agent AND g.ie EQ '0' "> <mvt:item name="toolkit" param="sassign|ns4|1" /> </mvt:if> <mvt:if expr=" 'windows' CIN g.http_user_agent "> <mvt:item name="toolkit" param="sassign|windows|1" /> </mvt:if> <mvt:if expr=" 'mac' CIN g.http_user_agent "> <mvt:item name="toolkit" param="sassign|mac|1" /> </mvt:if> <mvt:comment>*** END Browser & OS Detect ***</mvt:comment> <!-- Echo back Variables for testing 0=false / 1=true Safari: &mvt:global:safari; IE General: &mvt:global:ie; IE 7: &mvt:global:ie7; NS7 / Firefox Family: &mvt:global:ns7_ff; Netscape 4: &mvt:global:ns4; Mac: &mvt:global:mac; Windows: &mvt:global:windows; Complete User Agent String: &mvt:global:http_user_agent; -->
Colin Puttick
Miva Web Developer @ Glendale Designs
Comment
-
Re: browser detection
What about
<mvt:item name="toolkit" param="vassign|agent|http_user_agent" />
&mvte:global:agent;Bill Weiland - Emporium Plus http://www.emporiumplus.com/store.mvc
Online Documentation http://www.emporiumplus.com/tk3/v3/doc.htm
Question http://www.emporiumplus.com/mivamodu...vc?Screen=SPTS
Facebook http://www.facebook.com/EmporiumPlus
Twitter http://twitter.com/emporiumplus
Comment
Comment