How to use packed js in <head> section so code executes?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mike Scirocco

    How to use packed js in <head> section so code executes?

    I've been asked to pack a very simple javascript function that resides
    in the <headsection of a page. I have the function working the way I
    want, but when I pack it using this packer:



    it doesn't execute at all. My procedure:

    1. enter javascript code between <script
    type='text/javascript>...</scripttags into packer.

    2. paste packed code between <script type='text/javascript>...</script>
    tags in <headsection of page.

    The code won't run. The code looks like this (shortened):

    eval(function(p ,a,c,k,e,d){e=f unction(c){retu rn
    c.toString(36)} ;if(!''.replace (/^/,String)){while (c
    <snip>
    noPop|if|functi on|var|location |n'.split('|'), 0,{}))

    Is there something basic that I'm doing wrong?
    Mike
  • Randy Webb

    #2
    Re: How to use packed js in &lt;head&gt; section so code executes?

    Mike Scirocco said the following on 9/12/2007 9:20 PM:
    I've been asked to pack a very simple javascript function that resides
    in the <headsection of a page. I have the function working the way I
    want, but when I pack it using this packer:
    >

    >
    it doesn't execute at all. My procedure:
    >
    1. enter javascript code between <script
    type='text/javascript>...</scripttags into packer.
    >
    2. paste packed code between <script type='text/javascript>...</script>
    tags in <headsection of page.
    >
    The code won't run. The code looks like this (shortened):
    >
    eval(function(p ,a,c,k,e,d){e=f unction(c){retu rn
    The eval is part of your problem.
    c.toString(36)} ;if(!''.replace (/^/,String)){while (c
    <snip>
    noPop|if|functi on|var|location |n'.split('|'), 0,{}))
    >
    Is there something basic that I'm doing wrong?
    From the looks of it, all the "packer" does (Deans anyway) is remove
    whitespace. You probably have a missing ; somewhere. Try JSLint and
    JSMin instead.

    --
    Randy
    Chance Favors The Prepared Mind
    comp.lang.javas cript FAQ - http://jibbering.com/faq/index.html
    Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/

    Comment

    • Mike Scirocco

      #3
      Re: How to use packed js in &lt;head&gt; section so code executes?

      Randy Webb wrote:
      Mike Scirocco said the following on 9/12/2007 9:20 PM:
      >I've been asked to pack a very simple javascript function that resides
      >in the <headsection of a page. I have the function working the way I
      >want, but when I pack it using this packer:
      >>
      >http://joliclic.free.fr/php/javascri...r/en/index.php
      >>
      >it doesn't execute at all. My procedure:
      >>
      >1. enter javascript code between <script
      >type='text/javascript>...</scripttags into packer.
      >>
      >2. paste packed code between <script
      >type='text/javascript>...</scripttags in <headsection of page.
      >>
      >The code won't run. The code looks like this (shortened):
      >>
      >eval(function( p,a,c,k,e,d){e= function(c){ret urn
      >
      The eval is part of your problem.
      >
      >c.toString(36) };if(!''.replac e(/^/,String)){while (c
      ><snip>
      >noPop|if|funct ion|var|locatio n|n'.split('|') ,0,{}))
      >>
      >Is there something basic that I'm doing wrong?
      >
      From the looks of it, all the "packer" does (Deans anyway) is remove
      whitespace. You probably have a missing ; somewhere. Try JSLint and
      JSMin instead.
      Randy,

      JSLint is very useful, I cleaned up my code and found a way to make it
      work.

      Thank You,
      Mike

      Comment

      Working...