Safari and Flash Video

Joined
Nov 15, 2011
Messages
948
Reaction score
150
Points
43
Location
Toronto
Your Mac's Specs
MBP 16” M1max 32/1tb and bunch of other mac/apple stuff
mootools, interesting link.

I have generally this php function for mobile detection, because most things I do involve php.

I got it from somewhere I forget and modified it. This version just checks for phones specifically.

PHP:
function detect_mobile()
{
    $_SERVER['ALL_HTTP'] = isset($_SERVER['ALL_HTTP']) ? $_SERVER['ALL_HTTP'] : '';
 
    $mobile_browser = '0';
 
    $agent = strtolower($_SERVER['HTTP_USER_AGENT']);
 
    if(preg_match('/(up.browser|up.link|mmp|symbian|smartphone|midp|wap|phone|iphone|ipod|android|xoom)/i', $agent))
        $mobile_browser++;
 
    if((isset($_SERVER['HTTP_ACCEPT'])) and (strpos(strtolower($_SERVER['HTTP_ACCEPT']),'application/vnd.wap.xhtml+xml') !== false))
        $mobile_browser++;
 
    if(isset($_SERVER['HTTP_X_WAP_PROFILE']))
        $mobile_browser++;
 
    if(isset($_SERVER['HTTP_PROFILE']))
        $mobile_browser++;
 
    $mobile_ua = substr($agent,0,4);
    $mobile_agents = array(
                        'w3c ','acs-','alav','alca','amoi','audi','avan','benq','bird','blac',
                        'blaz','brew','cell','cldc','cmd-','dang','doco','eric','hipt','inno',
                        'ipaq','java','jigs','kddi','keji','leno','lg-c','lg-d','lg-g','lge-',
                        'maui','maxo','midp','mits','mmef','mobi','mot-','moto','mwbp','nec-',
                        'newt','noki','oper','palm','pana','pant','phil','play','port','prox',
                        'qwap','sage','sams','sany','sch-','sec-','send','seri','sgh-','shar',
                        'sie-','siem','smal','smar','sony','sph-','symb','t-mo','teli','tim-',
                        'tosh','tsm-','upg1','upsi','vk-v','voda','wap-','wapa','wapi','wapp',
                        'wapr','webc','winw','xda','xda-'
                        );
 
    if(in_array($mobile_ua, $mobile_agents))
        $mobile_browser++;
 
    if(strpos(strtolower($_SERVER['ALL_HTTP']), 'operamini') !== false)
        $mobile_browser++;
 
    // Pre-final check to reset everything if the user is on Windows
    if(strpos($agent, 'windows') !== false)
        $mobile_browser=0;
 
    // But WP7 is also Windows, with a slightly different characteristic
    if(strpos($agent, 'windows phone') !== false)
        $mobile_browser++;
 
    if($mobile_browser>0)
        return true;
    else
        return false;
}
 
OP
C
Joined
May 9, 2011
Messages
31
Reaction score
0
Points
6
Hi Groovetube

Thanks for sharing this...very useful code you got there! :)

Hopefully this browser and phone compatibility war stops anytime soon in the future...its a mess trying to show your website everywhere the same way you designed it (if not impossible)

Btw... interesting thing to check out.. Photoshop CS6 is out and it looks very interesting

Download Adobe Photoshop CS6 Beta - Adobe Labs

Maybe Flash CS6 export to HTML5 in the near future? (....keep dreaming! :| ... )

Adobe Edge is something i look forward though!!
 
Joined
Nov 15, 2011
Messages
948
Reaction score
150
Points
43
Location
Toronto
Your Mac's Specs
MBP 16” M1max 32/1tb and bunch of other mac/apple stuff
flash already does, it has for some time.

And that's about to get far more involved with far more js libraries.

Throughout all of the screaming "flash is dead" threads I've endured over the last couple years, the one thing that seems constant is often those involved in those threads in general had no idea about what they were talking about.

The flash player, is the real problem, and has been long before iOS came out. It filled a void that the html spec was far, far too slow to pick up on. There's a push now to get quicker specs and support for html5/CSS3, but for now jquery and js is really picking up the slack.

As far as flash, the authoring program, that isn't going anywhere anytime soon. To those who knew what I was talking about, I've always said, it's no coincidence that AS3 is practically identical to JS in syntax. (actually not far off from PHP either)

Some people got it. And by the looks of things, yup. That's where it's going.

As for troubles now, the biggest problem besides the bloat of the flash player, is the enormous number of people coding flash without much experience, causing all sorts of huge problems. You can take out a browser pretty easily with shoddy code, and no respect for proper garbage collection.

But that's going to be a problem with all the js/jquery laden sites with effects soon enough as well. And no flash blocker will help.
 

vansmith

Senior Member
Joined
Oct 19, 2008
Messages
19,924
Reaction score
559
Points
113
Location
Queensland
Your Mac's Specs
Mini (2014, 2018, 2020), MBA (2020), iPad Pro (2018), iPhone 13 Pro Max, Watch (S6)
but for now jquery and js is really picking up the slack.
jQuery is JS. ;)

mootools, interesting link.
Yeah, like I said earlier, its browser detection is far more simple than any other method I've ever seen. One of the great things about it is the ability to differentiate between Chrome and Safari since it seems most detection scripts work by user agent and thus, read both browsers as "WebKit."

I have generally this php function for mobile detection, because most things I do involve php.

I got it from somewhere I forget and modified it. This version just checks for phones specifically.

PHP:
function detect_mobile()
{
    $_SERVER['ALL_HTTP'] = isset($_SERVER['ALL_HTTP']) ? $_SERVER['ALL_HTTP'] : '';
 
    $mobile_browser = '0';
 
    $agent = strtolower($_SERVER['HTTP_USER_AGENT']);
 
    if(preg_match('/(up.browser|up.link|mmp|symbian|smartphone|midp|wap|phone|iphone|ipod|android|xoom)/i', $agent))
        $mobile_browser++;
 
    if((isset($_SERVER['HTTP_ACCEPT'])) and (strpos(strtolower($_SERVER['HTTP_ACCEPT']),'application/vnd.wap.xhtml+xml') !== false))
        $mobile_browser++;
 
    if(isset($_SERVER['HTTP_X_WAP_PROFILE']))
        $mobile_browser++;
 
    if(isset($_SERVER['HTTP_PROFILE']))
        $mobile_browser++;
 
    $mobile_ua = substr($agent,0,4);
    $mobile_agents = array(
                        'w3c ','acs-','alav','alca','amoi','audi','avan','benq','bird','blac',
                        'blaz','brew','cell','cldc','cmd-','dang','doco','eric','hipt','inno',
                        'ipaq','java','jigs','kddi','keji','leno','lg-c','lg-d','lg-g','lge-',
                        'maui','maxo','midp','mits','mmef','mobi','mot-','moto','mwbp','nec-',
                        'newt','noki','oper','palm','pana','pant','phil','play','port','prox',
                        'qwap','sage','sams','sany','sch-','sec-','send','seri','sgh-','shar',
                        'sie-','siem','smal','smar','sony','sph-','symb','t-mo','teli','tim-',
                        'tosh','tsm-','upg1','upsi','vk-v','voda','wap-','wapa','wapi','wapp',
                        'wapr','webc','winw','xda','xda-'
                        );
 
    if(in_array($mobile_ua, $mobile_agents))
        $mobile_browser++;
 
    if(strpos(strtolower($_SERVER['ALL_HTTP']), 'operamini') !== false)
        $mobile_browser++;
 
    // Pre-final check to reset everything if the user is on Windows
    if(strpos($agent, 'windows') !== false)
        $mobile_browser=0;
 
    // But WP7 is also Windows, with a slightly different characteristic
    if(strpos($agent, 'windows phone') !== false)
        $mobile_browser++;
 
    if($mobile_browser>0)
        return true;
    else
        return false;
}
You win the prize for comprehensive browser detection in PHP. Most of the scripts I've seen only go as far as using the $_SERVER['HTTP_USER_AGENT'] variable with some minor parsing.
 
Joined
Nov 15, 2011
Messages
948
Reaction score
150
Points
43
Location
Toronto
Your Mac's Specs
MBP 16” M1max 32/1tb and bunch of other mac/apple stuff
It's very good, and easy to modify for the purpose you need. I'll hunt down who originally wrote and offered it up originally if I can find it.

I had written something similar a while ago, but this one was far better than my own.
 
OP
C
Joined
May 9, 2011
Messages
31
Reaction score
0
Points
6
As far as flash, the authoring program, that isn't going anywhere anytime soon. To those who knew what I was talking about, I've always said, it's no coincidence that AS3 is practically identical to JS in syntax. (actually not far off from PHP either)

Some people got it. And by the looks of things, yup. That's where it's going.

Totally agree with you Groovetube.. it does seem to go that way and after a research i did on the web Flash CS6 is going to export to HTML5 (only animations and maybe some actionsript)

Check this link out

http://tv.adobe.com/watch/adobe-technology-sneaks-2011/adobe-html5/

Around 4:00 he speaks about it.!! I cant wait ....:Cool:
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top