What is my script src URL?

Put this in the js file that needs to know it’s own url. Fully Qualified (eg http://www.example.com/js/main.js): var scriptSource = (function(scripts) { var scripts = document.getElementsByTagName(‘script’), script = scripts[scripts.length – 1]; if (script.getAttribute.length !== undefined) { return script.src } return script.getAttribute(‘src’, -1) }()); Or As it appears in source (eg /js/main.js): var scriptSource = (function() … Read more

get absolute path of a file which is outside workspace in java

Although you didn’t ask certainly what you want to do, I assume that you want to open a file programmatically from a file which is in harness. You can ‘navigate’ programmatically using the following methods: File currentDir = new File(“.”); //this will be your current directory File parentDir = currentDir.getParentFile(); //this is parent directory File … Read more