as3lang / swfobject

An open source Javascript framework for detecting the Adobe Flash Player plugin and embedding Flash (swf) files.
11 stars 0 forks source link

Review Adobe web site usage of SWFObject #2

Open zwetan opened 8 years ago

zwetan commented 8 years ago

On the about Adobe Flash Player page

we can view in the sources 2 swfobject.js file

first one http://wwwimages.adobe.com/www.adobe.com/ubi/template/identity/lib/swfobject.js is SWFObject v1.4.4 with some custom modifications by Adobe

/**
 * SWFObject v1.4.4: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
 *
 * SWFObject is (c) 2006 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 * **SWFObject is the SWF embed script formerly known as FlashObject. The name was changed for
 *   legal reasons.
 *
 * Portions Copyright 2006 Adobe Systems Incorporated
 * + wrap with adobe.SWFObject
 * + getSWFHTML()
 *      - use NAME for name instead of id
 *      - added CODEBASE for IE fork
 *      - added alertswfo for debugging
 * + write()
 *      - added onFailFunc
 *
 */

second one http://wwwimages.adobe.com/www.adobe.com/ubi/template/identity/lib/swfobject.addon.js is an addon

/*  SWF OBJECT QUEUE
    to control when objects are written in the document
*/
zwetan commented 8 years ago

On the Get Adobe Flash Player page

the swfobject.js is SWFObject v2.2 https://wwwimages2.adobe.com/downloadcenter/singlepage/live/js/swfobject/swfobject.js

/*! SWFObject v2.2 <http://code.google.com/p/swfobject/>
    is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
*/

but in the page we can see also some custom detection

            var found = false;
            var googleType = "Chrome";
            var f = "";

            function queryObj() {
                var result = {}, queryString = location.search.slice(1),
                    re = /([^&=]+)=([^&]*)/g, m;

                while (m = re.exec(queryString)) {
                    result[decodeURIComponent(m[1])] = decodeURIComponent(m[2]);
                }

                return result;
            }

            if (googleType == "Chrome") {
                for (var i = 0; i < navigator.plugins.length; i++) {
                    f = navigator.plugins[i].filename;
                    if (f == "gcswf32.dll" || f == "Flash Player Plugin for Chrome.plugin" || f == "libgcflashplayer.so" || f == "pepflashplayer.dll" || f == "PepperFlashPlayer.plugin") {
                        found = true;
                    }
                }

                // Usage:
                var source = queryObj()["source"];          

                if (source == "farmville2") {
                    if (!found) window.location.href = "/flashplayer/?no_redirect&source=farmville2";
                }
                else {
                    if (!found) window.location.href = "/flashplayer/?no_redirect";
                }   
            }