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.
Page 2 of 4 FirstFirst 1234 LastLast
Results 16 to 30 of 53
  1. #16
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,273
    Thanks
    10
    Thanked 581 Times in 562 Posts
    Quote Originally Posted by felgall View Post
    Query abandoned using packer because a compressed minimised version downloads and runs faster than the packer version even though it is a slightly larger download.
    Quote Originally Posted by felgall View Post
    I never commented on which was larger. A larger download can run faster if the smaller one has to "unpack" itself first.
    maybe i mis-understood; it seemed like you said both that the code runs faster and that gZip-alone results in a larger download than packer-alone, both of which are demonstrably false. gZip saves CDNs bandwidth, but using packer and gZip wastes bandwidth. code is code once it's alive, and 0.32ms to unpack can easily be less than the delay of accessing a fully-cached URL, much less a 304 or heaven forbid, a 200 response. so, even in start-to finish time, it's not safe to say that packer slows down anything at all. once unpacked, the code runs with identical performance characteristics. Even the eval overhead is only ~10% of raw, so steve souders himself says "go for it", under the right use-case.

    back in the day when browser js execution was slow, packer had a much bigger footprint and penalty than now with five years+ of js and moore's law advancements. according to JR himself, (Total_Speed = Time_to_Download + Time_to_Evaluate). see resig's take on over-all performance for a baseline, and consider how unpacking time is now 0.32ms instead of ~70ms. but even 0.32 is > zero, and if the TimeToDownload is GREATER on a packed script than an unpacked script, packer makes no sense at all, other than for edge-case uses like delivering persist-able compressed JSON, require() implementations, etc.
    Last edited by rnd me; 08-08-2013 at 09:06 PM.
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/5/28) IE7:0.1, IE8:5.3, IE11:8.4, IE9:3.2, IE10:3.2, FF:18.2, CH:46, SF:7.9, NON-MOUSE:32%

  2. #17
    Regular Coder
    Join Date
    Jan 2013
    Location
    Germany
    Posts
    578
    Thanks
    4
    Thanked 77 Times in 77 Posts
    I must be naive to assume that it's beginners who post questions here – when I read something like "marketing reasons", it must be a more "professional" environment, which makes me wonder why the people hired to write the script (or whoever was put in charge of putting it together, whether they wrote it or not) couldn't answer such a simple question.

    Makes me think the script is terrible, too – for different reasons, though.

  3. #18
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,590
    Thanks
    0
    Thanked 644 Times in 634 Posts
    Quote Originally Posted by rnd me View Post
    maybe i mis-understood;
    Possibly what I said was a bit misleading since as you pointed out it is not always true that switching away from using packer makes things faster.

    The point that I was trying to make is that packer was introduced in prder to make the downloading and execution of JavaScript faster at a time when most people had slow internet connections. The purpose of packer never included anything even slightly related to attempting to hide JavaScript. At least some scripts that used to use packer have now ceased to do so as with those scripts not using packer is now more efficient (eg. jQuery).

    While the highly efficient code written by JavaScript experts such as John Resig and Dean Edwards nowoften works best using a minified rather than a packed version, that is as you say almost certainly not true of all scripts, particularly those written by newbies that usually contain arount 4 to 10 times as much code as is needed to perform any given task than is actually needed. The newbies may be using packer to compress theircode because it does allow it to download run faster than their original (although still not as fast as if the code were rewritten properly). So perhaps a lot of the newbies are using it to make up for defficiencies in their code rather than because they are trying to hide their code (in the mistaken belief that hiding JavaScript is possible).
    Last edited by felgall; 08-08-2013 at 10:33 PM.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  4. #19
    New to the CF scene
    Join Date
    Aug 2013
    Posts
    8
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Asking is reasonable sure . ASSUMING I have code i'm "ashamed of" (or whatever is presumptuous...)

    Quote Originally Posted by Philip M View Post
    Your question was "how to hide javascript code in page source?" This is a very old question which has been answered many, many times before. Including in a sticky. http://www.codingforums.com/javascript-programming/34358-javascript-frequently-asked-questions-post252783.html

    The answer is "THAT IS NOT POSSIBLE". OK? It is also reasonable to ask why you want to do this in any case.

  5. #20
    New to the CF scene
    Join Date
    Aug 2013
    Posts
    8
    Thanks
    1
    Thanked 0 Times in 0 Posts
    LOL...

    Quote Originally Posted by Airblader View Post
    I must be naive to assume that it's beginners who post questions here – when I read something like "marketing reasons", it must be a more "professional" environment, which makes me wonder why the people hired to write the script (or whoever was put in charge of putting it together, whether they wrote it or not) couldn't answer such a simple question.

    Makes me think the script is terrible, too – for different reasons, though.

  6. #21
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,590
    Thanks
    0
    Thanked 644 Times in 634 Posts
    Quote Originally Posted by otherwhirl View Post
    Asking is reasonable sure . ASSUMING I have code i'm "ashamed of" (or whatever is presumptuous...)
    No one ever said you were ashamed of your code. The statement I made was that the only people who attempt to hide their code are newbies who are yet to learn how to write their code properly and who have yet to learn that hiding JavaScript code is impossible. That the only code where an attempt is made to "hide" it is badly written (since the newbie hasn't learnt better yet) gives the appearance that they are ashamed of it since they have tried to hide it - that appearance obviously does not correspond to reality since theose responsible have simply not yet learnt enough JavaScript to do any better or they'd have learnt enough to know that it can't be hidden.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  7. #22
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,023
    Thanks
    75
    Thanked 4,323 Times in 4,289 Posts
    And I said
    how is your code so much more sophisticated than theirs that it is more important to hide it?
    Meaning perhaps you think your code is really really good and it should be hidden. Opposite of "ashamed".
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  8. #23
    New Coder
    Join Date
    Jan 2013
    Location
    Florida
    Posts
    75
    Thanks
    2
    Thanked 0 Times in 0 Posts
    haven't you guys ever worked for days or weeks to figure out how to do something, and have it turn out so well that it seems unique ? say you apply it to a website and like it very much and don't see any other websites in your little niche business that are doing what you can do.

    at least for a time you may hope to enjoy the fruits of your labor, and maybe make a few more sales.

    Phillip M, i am sure that it has been asked before, and a quick reference to the archive was nice. but get out of the way of the mother hens clucking about "why do you want to do this ?" "are you ashamed of yourself ?" "have you sinned ?" "tell doctor phil about your sordid motivation". i can see them shaking their fingers. busy bodies. the guy asked a simple question.

    start shaking your fingers at me, i haven't capitalized according to hoyle.
    Last edited by pratto; 08-09-2013 at 06:59 AM.

  9. #24
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,898
    Thanks
    203
    Thanked 2,530 Times in 2,508 Posts
    The very fact that you ask this question suggests that you are not very experienced with Javascript. So it is less credible that you have written unique code which no-one else has yet thought up.

    I imagined that "marketing reasons" meant that you were trying to use some sort of discount code, and then 'if (discountcode == "ABCD") {price = price *.9}' or something. It is impossible to conceal the discount code client-side.

    Failure to use capital letters appropriately simply says that you are semi-literate. Nothing clever about that at all.
    Last edited by Philip M; 08-09-2013 at 08:24 AM.

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.

  10. #25
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,590
    Thanks
    0
    Thanked 644 Times in 634 Posts
    Quote Originally Posted by pratto View Post
    haven't you guys ever worked for days or weeks to figure out how to do something, and have it turn out so well that it seems unique ? say you apply it to a website and like it very much and don't see any other websites in your little niche business that are doing what you can do.
    You would do all of that with server side code and only use JavaScript for minor things that enhance the user experience and which don't give away the "unique" processing.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  11. #26
    New to the CF scene
    Join Date
    Aug 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You can't hide any thing on client side code, if you want to hide them to it on server side.
    Last edited by vinyl-junkie; 08-09-2013 at 01:34 PM. Reason: signatures only allowed through the control panel

  12. #27
    Senior Coder DanInMa's Avatar
    Join Date
    Nov 2010
    Location
    Salem,Ma
    Posts
    1,577
    Thanks
    13
    Thanked 248 Times in 248 Posts
    I cant believe this thread is still going. lol.

    No. The answer you are looking for is No. Anyone with a browser that has a development mode of some kind, can see your script.

  13. #28
    New Coder
    Join Date
    Jan 2013
    Location
    Florida
    Posts
    75
    Thanks
    2
    Thanked 0 Times in 0 Posts
    and using cap's makes you a good boy, and oh so smart.

  14. #29
    New Coder
    Join Date
    Jan 2013
    Location
    Florida
    Posts
    75
    Thanks
    2
    Thanked 0 Times in 0 Posts
    leaving the personal needling behind (hopefully), and back to the original question - doesn't just putting your JS in a referenced .js page effectively keep it from being viewed with source code ?

  15. #30
    Senior Coder jmrker's Avatar
    Join Date
    Aug 2006
    Location
    FL
    Posts
    3,065
    Thanks
    36
    Thanked 497 Times in 491 Posts

    Arrow

    Quote Originally Posted by otherwhirl View Post
    My purposes have to do with marketing reasons .
    It has ZERO to do with what Google thinks...
    Then the recommendation would be to use some other programming language than javascript.


 
Page 2 of 4 FirstFirst 1234 LastLast

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
  •