Link to home
Start Free TrialLog in
Avatar of kuntilanak
kuntilanakFlag for United States of America

asked on

hide javascript function

How can I hide a javascript function that is embedded in an aspx page so that when a user does a view->source, then they can't see the particular javascript code. I know there isn't a way to 100% hide it, but some ways to do this are appreciated..
ASKER CERTIFIED SOLUTION
Avatar of Seo_Expert
Seo_Expert
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of kuntilanak

ASKER

how do I use the link above? just copy and paste the resulting obfuscated code?
Avatar of Michel Plungjan
Yes.

however it is not secure, it will only hide it for someone not very technical
You could put the code into an external file and reference it using the code below. This will hide it from the view source but if you use any plugin for developers you will be able to view the associated javascript. Ultimately the script needs to be processed by the client so it will be sent to the client and is therefore visible.

Cheers,

Lee

<script language="javascript" src="../somelocalpath/file.js"></script>

Open in new window