Skip to Main Content
  • Questions
  • How can I use javascript file with PL/SQL HTML stored procedures ?

Breadcrumb

Question and Answer

Tom Kyte

Thanks for the question, Alan.

Asked: October 09, 2000 - 1:33 pm UTC

Last updated: May 07, 2006 - 10:52 am UTC

Version: 4.0.7

Viewed 1000+ times

You Asked

When I want to protect the javascript source code from the client I put it in *.js file and put this file in the same directory where the *.html exists. But in my case I don't have
a *.html file, I have a stored PL/SQL procedure that generates the HTML page when the client request it. So how can I do to reference this external *.js file. Because I'm trying to put this file in the same virtual path of the procedure and nothing happens

and Tom said...

Your choices are two fold:

1) do not use the same virtual path. The virtual path you have defined to run PLSQL cannot retrieve files -- it is defined to run PLSQL. If you use a slightly different virtual path -- it'll work just fine.

2) have the PLSQL return the javascript as well. If you are using a URL like:
http: //hostname/foo/plsql/mystuff.js

and mystuff.js is currently a file, simply create a package called mystuff, have a procedure called JS in it. and have JS return the text that is currently in the file.

Rating

  (2 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

Protecting javascript

Tom, July 02, 2004 - 5:33 am UTC

The way I do this is to create an alias in mod_plsql of the form

Alias /js/ "d:\directory\for\javascript/"

then you can simply link to the javascript by placing the following link in the html header

<SCRIPT TYPE="Javascript" LANGUAGE="Javascript" SRC="/js/myfile.js"></SCRIPT>

Please note that putting javascript in a separate file does not stop people viewing it if they are determined....it just makes it harder [you can always use a command line program like wget to fetch the javascript file].

Tom Kyte
July 02, 2004 - 9:59 am UTC

and people on a high latency link (like me, on a sattelite link or dialup) hate those pages! round trips kill us :(

those are the slowest sites for me...

Java Script

D.Ghosh, May 06, 2006 - 2:54 am UTC

I want to use MOUSE TAIL in 10g forms. as we view on website. it's a great idea . when mouse move on the canvas the text ( companies name or logo) move with the mouse. if possible please let me know in details.


Tom Kyte
May 07, 2006 - 10:52 am UTC

you are kidding right? Just consult your favorite windows site, this would be be some gimick you would do at the OS level (and one that would cause me to immediately erase your product from all of my machines upon seeing it, ugh)

More to Explore

PL/SQL demos

Check out more PL/SQL tutorials on our LiveSQL tool.

PL/SQL docs

PL/SQL reference manual from the Oracle documentation library