0

I thought that cgi-bin would be a good place to store a JS script, but it's not found using

<script type="text/javascript" src="cgi-bin/jscripts1.js"></script>

Renaming and changing cgi-bin to cgibin makes it work. Is this documented somewhere?
I thought the hypen was the most-accepted special character.

dcromley
  • 1,373
  • 1
  • 8
  • 23
  • hyphen should work just fine ? – adeneo May 17 '14 at 17:42
  • 6
    Try a different path with a hyphen, like `test-path` and see if that works. `cgi-bin` might be protected or something. – ntzm May 17 '14 at 17:43
  • I would argue that `cgi-bin` is not a good place for JavaScript files that are included in the page markup as client-side scripts (which is what you seem to be doing), as that directory is a fairly universal location for back-end [Common Gateway Interface](https://en.wikipedia.org/wiki/Common_Gateway_Interface) (CGI) scripts that dynamically produce markup on the server side before sending it to the client browser (like Ruby scripts). That isn't the purpose of your `jscripts1.js` file, so it makes more sense to put it elsewhere (`js` is a common location). – ajp15243 May 17 '14 at 17:51
  • @Nat Zimmermann - test-path works. Same permissions (755) and owner/group as cgi-bin. Somehow protected? Thanks. You get ONE point from me? – dcromley May 17 '14 at 22:25
  • hyphen should work. Do one thing try like this "~/cgi-bin/jscripts1.js" – Tanul May 18 '14 at 13:19
  • 1
    @Tans - tried that -- didn't work at all. cgi-bin works on my localhost but not on (Hostmonster hosted) dbarc.net. Go there. Tnx. – dcromley May 19 '14 at 01:55
  • I opened the website and clicked F12 to open developer tools in chrome. It shows .js files in cgi-bin folder. But the nothing is written over there. In ~/cgi-bin folder you've .js named as jscripts3.js.In cgi-bin folder you've .js named as jscripts2.js. But both the js are empty. Kindly check. – Tanul May 19 '14 at 15:17
  • If the website was unable to locate the folder then there were fewer chances of getting the scripts displayed in the developer tools. As I've seen scripts are there but they doesn't have details. Kindly check.... – Tanul May 19 '14 at 16:03
  • @Tans - I misunderstood your "~" so jscripts3.js didn't have a chance. Yes, I'm quite sure that additional directory ("~") would work, but I'd prefer test-path. My Filezilla shows all 3 *.js files as 35 bytes -- they are all the same except for 1, 2, or 3. URL dbarc.net/test-path/jscripts1.js gives the 35-byte script. URL dbarc.net/cgi-bin/jscripts2.js gives `500 Server Error A misconfiguration on the server caused a hiccup. Check the server logs, fix the problem, then try again.` Hit dcromley for my email. – dcromley May 19 '14 at 16:57
  • @Tans - My server log says `[Mon May 19 11:04:02 2014] [error] [client 71.36.10.66] Premature end of script headers: jscripts2.js` I've enjoyed all I can stand of this. :) I just won't use cgi-bin. – dcromley May 19 '14 at 17:07
  • See ~ represents nothing but the current directory. If I'll describe it in layman language then cgi-bin and ~/cgi-bin both are same locations. But the purpose of inserting ~ is that it makes run-time control easy to get the exact path of the js. Do a small practice drag the js and drop it on the page in visual studio(or any other software) where you want to write the link. You'll see that automatically a script tag got created with the exact and appropriate path to js in src property. – Tanul May 19 '14 at 17:59
  • `Please avoid extended discussions in comments. Would you like to automatically move this discussion to chat?` @Tans - email me. @Nat Zimmermann - I'm still at it. – dcromley May 19 '14 at 19:18

1 Answers1

0

I tested out the code on my local apache server. The code works fine. The problem seems to with your hosted server (Hostmonster) as you have mentioned in the comments.

An alternative to using hypen would be to encode it in the url as shown.

<script type="text/javascript" src="cgi%2Dbin/jscripts1.js"></script>

Also check the following links :

HTML: href syntax : is it okay to have space in file name

https://github.com/bhauman/lein-figwheel/issues/5

https://github.com/emezeske/lein-cljsbuild/issues/260

Community
  • 1
  • 1
Midhun Darvin
  • 1,236
  • 14
  • 24