Get $_SERVER[‘HTTP_HOST’] by javascript / get absolute path of server file script 1 comment


Get $_SERVER[‘HTTP_HOST’] by javascript / get absolute path of server file script

function getAbsolutePath() {
    var loc = window.location;
    var pathName = loc.pathname.substring(0, loc.pathname.lastIndexOf('/') + 1);//to get path of current url
    return loc.href.substring(0, loc.href.length - ((loc.pathname + loc.search + loc.hash).length - pathName.length));
}

Share on Facebook




About Pragnesh Karia

Pragnesh Karia, Open Source Enthusiast, Software Professional, Software Developer, Technical Lead ,Magento, Joomla ,Joomla LMS , Moodel LMS ,PHP ,Mysql, Ajax, Javascript, Jquery, Linux, Fan of Open Sources , Annet Technologies , SEO Analyst , Mootools


One thought on “Get $_SERVER[‘HTTP_HOST’] by javascript / get absolute path of server file script