Substitute window.location
properties with values you provide via a url.
$ npm install locationify --save
source:
var url = window.location.origin + '/post';
bundle:
var url = "http://foo.com" + '/post';
Have scripts running off the filesystem return window.location
values as though they were hosted. eg. Compiling an application returned by a webserver into a phonegap app.
var browserify = require('browserify');
var locationify = require('locatonify');
var b = browserify();
b.add('./browser/main.js');
b.transform(locationify('http://foo.com/'));
b.bundle().pipe(process.stdout);