Tumblelog by Soup.io
Newer posts are loading.
You are at the newest post.
Click here to check if anything new just came in.

__FILE__ in JavaScript

Many programming languages provide a magic __FILE__ variable which holds the path to the currently executing file. JavaScript unfortunately don’t. Using several sources, I implemented a __FILE__ variable for JavaScript. Unfortunately it does not work in all browsers, especially not in Internet Explorer and Safari. There seems to be a possibility for IE10, but lacking a Windows 8 machine I can’t test it. If you find a way for these browsers or other improvements please contribute your code.

Here’s the source code: https://gist.github.com/3891980

Sources I used for this GIST:

Don't be the product, buy the product!

Schweinderl