Solved

ASP as Javascript src

Posted on 2001-07-12
2
372 Views
Last Modified: 2006-11-17
Hi :-)

I have experimented with including asp files, as a javascript file.

Like

<script language="JavaScript" type="text/javascript" src="file.asp">
</script>

The the file.asp should generate the javascript.
It works for me, but people get error in Internet Explore 4.72. Is this only because of the stupid errors in Explore or is wrong to use anything else then .js extension as a javascript file ?

0
Comment
Question by:Netgurudk
[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
2 Comments
 
LVL 7

Accepted Solution

by:
CJCraft earned 25 total points
ID: 6276622
You could add the .js extension to the IIS Application Mappings and have asp.dll parse .js files, like it does .asp, before it sends the results to the client. This should take care of any issues with any browser. Since if I remember right, Netscape browsers only accept .js files for external JavaScript files.

Here's how to do it:
1. Open Internet Services Manager.
2. Right-click the Web server, and choose Properties from the context menu.
3. Master Properties
4. Select WWW Service | Edit | HomeDirectory | Configuration

From there you should see:

.asp C:\WINNT\System32\inetsrv\asp.dll GET,HEAD,POST,TRACE

ADD one for .js files that is:

.js C:\WINNT\System32\inetsrv\asp.dll GET,HEAD,POST,TRACE

If you are using the above technique to protect your client-side JavaScript from being read by users, then remember not only check the HTTP_REFERER header but also to disable caching on the browser so the user can't view the .js file from their Temporary Internet Files folder either.

I'd use the following:

<%
Response.Expires = 60
Response.Expiresabsolute = Now() - 1
Response.AddHeader "pragma","no-cache"
Response.AddHeader "cache-control","private"
Response.CacheControl = "no-cache"
%>

Hope it helps,
CJCraft
0
 

Author Comment

by:Netgurudk
ID: 6276695
Thank you very much ;)
0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

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