Skip to content

Commit 4bda699

Browse files
authored
Merge pull request #1 from the5fire/fix-pageBaseProtocol-miss
补充pageBaseProtocol的定义
2 parents ef718b7 + 3b3ade9 commit 4bda699

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

static/js/tracker/path.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
window.Tracker = window.Tracker || {};
22

33
Tracker.Path = function(){
4-
var protocolRegx, absoluteRegx, rootRegx, doubleDotRegx, singleDotRegx;
4+
var protocolRegx, absoluteRegx, rootRegx, doubleDotRegx, singleDotRegx, pageBaseProtocol;
55

66
protocolRegx = /^\w+:\/\//;
77
absoluteRegx = /^\//;
88
rootRegx = /^(\w*:?\/?\/?)([\w.]+)(\/)/;
99
doubleDotRegx = /\/[^\/\.]+\/\.\.\//;
1010
singleDotRegx = /\/\.\//;
11+
pageBaseProtocol = window.location.href.split('//')[0];
1112

1213
return {
1314
getBase: function( document ){
@@ -27,7 +28,7 @@ Tracker.Path = function(){
2728

2829
merge: function( base, url ){
2930
if( url.indexOf( "//" ) === 0 )
30-
return pageBaseProtocol + ":" + url;
31+
return pageBaseProtocol + url;
3132

3233
if( protocolRegx.test( url ) )
3334
return url;

0 commit comments

Comments
 (0)