diff --git a/clib/dpd.js b/clib/dpd.js index 298f7af..184b5ab 100644 --- a/clib/dpd.js +++ b/clib/dpd.js @@ -2,7 +2,10 @@ if (!window._dpd) window._dpd = {}; - var root = window.location.origin; + var root = window.location.protocol + '//' + window.location.hostname; + if (window.location.port !== '') { + root += ':' + window.location.port; + } var consoleLog = (typeof console !== 'undefined') && console.log; diff --git a/lib/resources/client-lib.js b/lib/resources/client-lib.js index 78fbab6..bf15310 100644 --- a/lib/resources/client-lib.js +++ b/lib/resources/client-lib.js @@ -39,9 +39,6 @@ ClientLib.prototype.handle = function (ctx, next) { ctx.res.setHeader('Content-Type', 'text/javascript'); var lib = resource.clientLib; - var host = ctx.req.headers.host; - if (lib) lib = lib.replace('var root = window.location.origin;', 'var root = "http://' + host + '";'); - ctx.res.write(lib); resource.generate(ctx.res, function() { ctx.res.end();