Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Jul 2010
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Alternative content for non-flash

    I have this code http://www.jsfiddle.net/Nntc7/ created by a pdf publisher, I need to offer non flash content to users but dont know javascript and I cant get the thing to work using swfobject, How do I edit this to allow for alternative content??

    thanks in advance

  • #2
    New to the CF scene
    Join Date
    Jul 2010
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts
    and here is the code

    Code:
    <script language="JavaScript" type="text/javascript">
    	
    	function getURLParam(strParamName){
        var strReturn = "";
        var strHref = window.location.href;
        if ( strHref.indexOf("?") > -1 ){
          var strQueryString = strHref.substr(strHref.indexOf("?")).toLowerCase();
          var aQueryString = strQueryString.split("&");
          for ( var iParam = 0; iParam < aQueryString.length; iParam++ ){
            if ( 
      aQueryString[iParam].indexOf(strParamName.toLowerCase() + "=") > -1 ){
              var aParam = aQueryString[iParam].split("=");
              strReturn = aParam[1];
              break;
            }
          }
        }
        return unescape(strReturn);
      }
    
     document.write(
        '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"\n'+
        '  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0"\n'+   
        '  WIDTH="100%" HEIGHT="100%" id="flashMovie" align="middle">\n'+
        '  <PARAM NAME="allowScriptAccess" value="sameDomain" />\n'+
      	'  <PARAM NAME="allowFullScreen" value="true" />\n'+
        '  <PARAM NAME=movie '+
        '    VALUE="flippingbook.swf?pageNumber='+getURLParam('pageNumber')+'" />\n'+
        '  <PARAM NAME=quality VALUE=high />\n'+
        '  <PARAM NAME=bgcolor VALUE=#ffffff />\n'+
        '  <PARAM NAME=scale VALUE=noscale />\n'+
        '  <EMBED src="flippingbook.swf?pageNumber=' + getURLParam('pageNumber') + '"' +
        '    bgcolor=#ffffff WIDTH="100%" HEIGHT="100% '+
        '    quality="high"' +
        '    scale="noscale"' +
        '    name="flashMovie"' +
        '    allowFullScreen="true"' +
        '    TYPE="application/x-shockwave-flash"'+
        '  />\n'+
        '</OBJECT>\n');
    	</script>

  • #3
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,485
    Thanks
    6
    Thanked 981 Times in 954 Posts
    You should look into the principle of progressive enhancement. PE means in your context that you provide your “alternative content” as default content and then replace that content with Flash if JS is available. This is also how the dynamic publishing method of SWFObject works. You have a plain old HTML container with the plain old HTML content and then you make SWFObject replace that HTML container with the Flash object.

    In the JS code that program gave you this is the part that writes the HTML for the Flash object:
    Code:
    document.write(
        '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"\n'+
        '  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0"\n'+   
        '  WIDTH="100%" HEIGHT="100%" id="flashMovie" align="middle">\n'+
        '  <PARAM NAME="allowScriptAccess" value="sameDomain" />\n'+
          '  <PARAM NAME="allowFullScreen" value="true" />\n'+
        '  <PARAM NAME=movie '+
        '    VALUE="flippingbook.swf?pageNumber='+getURLParam('pageNumber')+'" />\n'+
        '  <PARAM NAME=quality VALUE=high />\n'+
        '  <PARAM NAME=bgcolor VALUE=#ffffff />\n'+
        '  <PARAM NAME=scale VALUE=noscale />\n'+
        '  <EMBED src="flippingbook.swf?pageNumber=' + getURLParam('pageNumber') + '"' +
        '    bgcolor=#ffffff WIDTH="100%" HEIGHT="100% '+
        '    quality="high"' +
        '    scale="noscale"' +
        '    name="flashMovie"' +
        '    allowFullScreen="true"' +
        '    TYPE="application/x-shockwave-flash"'+
        '  />\n'+
        '</OBJECT>\n');
    Now you just have to extract the plain HTML which comes down to this:
    Code:
    <OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0"  WIDTH="100%" HEIGHT="100%" id="flashMovie" align="middle">
    	<PARAM NAME="allowScriptAccess" value="sameDomain" />
    	<PARAM NAME="allowFullScreen" value="true" />
    	<PARAM NAME=movie VALUE="flippingbook.swf?pageNumber='+getURLParam('pageNumber')+'" />
    	<PARAM NAME=quality VALUE=high />
    	<PARAM NAME=bgcolor VALUE=#ffffff />
    	<PARAM NAME=scale VALUE=noscale />
    </OBJECT>
    … and replace it with SWFObject. There is an elaborate documentation about how to implement it on their website. But note that you have that getURLParam() function in your JS code, too, which is used in that one param element. You probably need to include that in your page so the correct URL parameters are created.

  • Users who have thanked VIPStephan for this post:

    L3EOO (07-27-2010)

  • #4
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    Hm. My question would be: alternative at Flash content for who? For the users who have no Flash plug-in installed? For the users who have Flash blocker installed and active? For the users who have javascript disabled (and the Flash is run trough a javascript code)?
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #5
    New to the CF scene
    Join Date
    Jul 2010
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts
    thanks VIPStephan got it working you made me think about the code in a new way and then the resolution was obvious.

    thanks
    Lee


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •