html - Convert relative path to absolute using JavaScript - Stack Overflow
function absolute(base, relative) {
var stack = base.split("/"),
parts = relative.split("/");
stack.pop(); // remove current file name (or empty string)
// (omit if "base" is the current folder without trailing slash)
for (var i=0; i<parts.length; i++) {
if (parts[i] == ".")
if (parts[i] == "..")
return stack.join("/");
javascript  requests  paths 
7 days ago
« earlier      
3d accessibility activerecord ajax algorithm amazon analytics android animation annarbor apache api apple apps architecture art astronomy audio bestpractices blog blogging book books bootstrap browser business canvas career cartography chrome cms cocoa code college color comics cooking couchdb css css3 culture data database debugging deployment design development digital diy django dog drupal editor education effects elasticsearch epub erlang events example film firefox flash fonts food forms framework fun funny gallery gamedev games gaming gender generator gifts gis git golang google googlemaps graphics grid hardware health history hosting house howto html html5 http hydra icons ie images imaging indexing inspiration interactive-fiction interesting internet ios ipad iphone java javascript jobs jquery json kitchen language layout leaflet library life lists macosx make maps markdown menu metadata mobile modules museum music mysql navigation nginx nodejs nyc orm patterns pdf people performance perl photography php plugins politics postgresql programming project:changethinking project:magpie project:mousetrap publishing python rails raspberrypi rdf reactjs recipes reference religion resources responsive rest robotics ruby sass science scifi scroll scrolling search security semanticweb shopping sinatra snippets social space sublime svg sysadmin tech technology templating testing text themes tips to:read to:research tools travel tutorial tv twitter typography ui unicode ux video visualization vuejs webdev writing wsgi wysiwyg xml xslt

Copy this bookmark: