Solved

How-To Lockdown .js Files

Posted on 2009-07-13
3
442 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
Comment Utility
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
Comment Utility
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
Comment Utility
Well that sucks.  Thank you.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Read about why website design really matters in today's demanding market.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
This video teaches users how to migrate an existing Wordpress website to a new domain.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

771 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now