var scripts= document.getElementsByTagName( 'script' ) var script= document.currentScript || scripts[ scripts.length - 1 ] alert( script.src )