Answers for "js get with path"

-1

js get path from url

var reg = /.+?\:\/\/.+?(\/.+?)(?:#|\?|$)/;
var pathname = reg.exec( 'http://www.somedomain.com/account/search?filter=a#top' )[1];
Posted by: Guest on April-29-2021
0

javascript get script path name

window.getRunningScript = () => {
    return () => {      
        return new Error().stack.match(/([^ \n])*([a-z]*:\/\/\/?)*?[a-z0-9\/\\]*\.js/ig)[0]
    }
}
console.log('%c Currently running script:', 'color: blue', getRunningScript()())
Posted by: Guest on January-07-2022

Code answers related to "Javascript"

Browse Popular Code Answers by Language