Solved

How-To Lockdown .js Files

Posted on 2009-07-13
3
450 Views
Last Modified: 2012-05-07
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://webpage.com/script.js)

I have full access to my webhost via cpanel.  Any ideas would be greatly appreciated.
-------------
index.html
-------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="keywords" content="Landscape design" />
<title>webpage</title>
<link rel="stylesheet" href="style.css" type="text/css">
<script src="flash.js" language="JavaScript" type="text/javascript"></script>
</head>
<body>
<div><script language="JavaScript" type="text/javascript">RunFlash();</script></div>
</body>
</html>
 
---------
flash.js
---------
function RunFlash()
{
document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,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="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="100%" height="800" />');
document.write('</object>');
}

Open in new window

0
Comment
Question by:aehare70
3 Comments
 
LVL 39

Accepted Solution

by:
Roger Baklund earned 500 total points
ID: 24845122
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.
0
 
LVL 7

Expert Comment

by:Jonah11
ID: 24845935
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.
0
 
LVL 1

Author Comment

by:aehare70
ID: 24850274
Well that sucks.  Thank you.
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Read about why website design really matters in today's demanding market.
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question