Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How-To Lockdown .js Files

Posted on 2009-07-13
3
Medium Priority
?
459 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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone 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

Does your audience prefer people in photos or no people? How can you best highlight what you’re selling? What are your competitors doing, and what can you do that is different and unique from them?  Continue reading to learn how to make your images …
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
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 is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.
Suggested Courses

636 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