?
Solved

How-To Lockdown .js Files

Posted on 2009-07-13
3
Medium Priority
?
457 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 39

Accepted Solution

by:
Roger Baklund earned 2000 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Originally, this post was published on Monitis Blog, you can check it here . It goes without saying that technology has transformed society and the very nature of how we live, work, and communicate in ways that would’ve been incomprehensible 5 ye…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

764 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