Forum Moderators: open
Also, I would like to be able to generate an encoded version of the script using PHP. I have used iScramble for this but I'm not sure if creating an encoded javascript of a javascript will work. Do you think it will work if I just encode the functions?
I'm not 100% sure what you mean about encoding your Javascript - hopefully someone with more insight will answer - but I think that if you try to present an encrypted or scrambled version of your script, it's not going to work.
does the javascript actually need to be in the <head> section of the page or can I put it anywhere?
Are you looking to put it somewhere else on the page, or in an external file (which you would then link to in the <head> )? The latter should work. The former depends on the particular code --many simple methods can be used anywhere, others have to be called in the head because they need to be applied FIRST, before other code. (Can you test it in the head, then just try moving it into the body and see if it still works?)
I've been having trouble encoding javascripts that are in the <head> section of the page, but it works great in the <body> portion. I was just unsure if I could move my javascripts from the <head> to the <body> and have them still work.
Actually the external file would be a great idea, except that the values in the javascript are created dynamically using PHP.
I'm just trying to hide my form variables so that people can't manually adjust prices using a javascript of their own.
ANY of the information coming from the browser can be spoofed.
Let the browser tell you the quantities. But the server should determine the price.