Solved

ASP as Javascript src

Posted on 2001-07-12
2
363 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Change visitor's REMOTE_ADDR to server's REMOTE_ADDR 2 51
ASP exit 10 34
My Do While is Not Producing Anything 15 88
JSON Error in ASP Page 3 39
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

751 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