PINK - javascript problem using src= in <script> tag
Ron Czapala
Posts: 2,418
I found a peculiar problem when·including·a javascript file with the src parameter of the <script> tag.·The·html and javascript files are shown below.
If the·dash is removed in the func_one alert statement (e.g.··'No http request capability'), the entire function is not served by the PINK module when using IE8 (works under FireFox). It's like the "http" in the literal string causes a problem. Changing it to "httpx" works and changing the file extension to .txt instead of .js works.
I might be a mime type problem with the PINK module not mapping the .js suffix to the application/x-javascript in the HHTP header or maybe it's an issue with IE8.
You can see what is returned by browsing to http://192.168.1.104/prob.js· (use your particular ip address of course). func_one does not even appear unless you modify the http literal.
It took a while to figure out what was happening but curious nonetheless!
If the·dash is removed in the func_one alert statement (e.g.··'No http request capability'), the entire function is not served by the PINK module when using IE8 (works under FireFox). It's like the "http" in the literal string causes a problem. Changing it to "httpx" works and changing the file extension to .txt instead of .js works.
I might be a mime type problem with the PINK module not mapping the .js suffix to the application/x-javascript in the HHTP header or maybe it's an issue with IE8.
You can see what is returned by browsing to http://192.168.1.104/prob.js· (use your particular ip address of course). func_one does not even appear unless you modify the http literal.
It took a while to figure out what was happening but curious nonetheless!
<html> <head> <title></title> <script type="text/javascript" language="javascript" src="prob.js"></script> </head> <body> Demo javascript problem <input type="button" value="One" onclick="return func_one()" id=button1 name=button1> <br> <input type="button" value="two" onclick="return func_two('Test func two')" id=button2 name=button2> <br> <input type="button" value="three" onclick="return func_three('doc write test')" id=button3 name=button3> </body> </html>
function func_one() { alert('No http-request capability'); } function func_two(sendtext){ alert(sendtext); } function func_three(sendtext) { document.write(sendtext); }
Comments
· The actual html and javascript in which I discovered the problem was more complex and uses xmlhttprequest to update PINK variables and send emails using basic stamp code.
To illustrate the problem I created this little demo html and javscript file to avoid any confusion·with the original BS2/Pink application.
·
Also, if you're using the PINK module then IIS doesn't have anything to do with this issue.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Engineering
50 72 6F 6A 65 63 74 20 53 69 74 65
·
·· The html/javascript works with FireFox and works locally on IIS using IE8 so I think it must be the way the PINK Netburner handles the .js file.
As I mentioned, if I rename the javascript file to prob.txt and change the script include to:
<script type="text/javascript" language="javascript" src="prob.txt"></script>
it works fine. This leads to to believe that the PINK is not using the right mime type (but somehow FireFox handles it?!?)
Maybe the netburner·was not designed/programmed to handle .js files.
If the javascript functions are moved into the html file, it also works.
Could not find any info on the netburner web site http://www.netburner.com/products/serial_to_ethernet/sb70.html
Post Edited (ronczap) : 10/18/2009 12:17:03 AM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Engineering
50 72 6F 6A 65 63 74 20 53 69 74 65
·
Javacript is client side of course, but so is html but the PINK module manipulates the html before sending it (to make variable substitutions) and it may also be processing the .js file before it is sent. This might·explain why it works with a .txt extension but not with .js
Compatibility mode has no effect. I am running XP professional (32 bit).
It is not a big deal but I wanted people who use the PINK to be aware.
It is a strange problem. Browsing to the .js file shows only the second and 3rd functions (if the first one has " http" in the literal.
Post Edited (ronczap) : 10/18/2009 12:21:34 AM GMT
··· The PINK module is the server - this has nothing to do with permissions under the operating system. The PINK module is connected directly to the router.
I was a web application developer before I retired and I understand the IIS configuration.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Engineering
50 72 6F 6A 65 63 74 20 53 69 74 65
·