How-To Lockdown .js Files

I have a page that displays an adobe flash file on load of the page via an html document.  Inside the html document I am loading the flash file via javascript.

I would like to:
1 - Lock down the HTML so the user can not see the references to the javascript information
2 - Lock down the .js file so the user can now access it directly via a URL/Command (i.e. hxxp://

I have full access to my webhost via cpanel.  Any ideas would be greatly appreciated.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="keywords" content="Landscape design" />
<link rel="stylesheet" href="style.css" type="text/css">
<script src="flash.js" language="JavaScript" type="text/javascript"></script>
<div><script language="JavaScript" type="text/javascript">RunFlash();</script></div>
function RunFlash()
document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase=",0,19,0" width="100%" height="800">');
document.write('<param name="movie" value="flash.swf" />');
document.write('<param name="quality" value="high" />');
document.write('<embed src="flash.swf" quality="high" pluginspage="" type="application/x-shockwave-flash" width="100%" height="800" />');

Open in new window

Who is Participating?
Roger BaklundConnect With a Mentor Commented:
This is not possible. You can scramble your code, but this will just trigger the curiosity of anyone looking at your source, you can not prevent anyone from accessing your .js file.

There might be other options. If you explain what problem you are trying to solve, we might be able to provide you with a usefull advice.
If you want to prevent direct access to the files, you could do something like creating a new special token   on each page load that only works one time.  But as cxr said, you cannot "lockdown" html or js.
aehare70Author Commented:
Well that sucks.  Thank you.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.