Skip to content

Commit

Permalink
fix some baseUrl issues
Browse files Browse the repository at this point in the history
  • Loading branch information
rbuels committed Aug 25, 2012
1 parent 98ceeda commit 8ce5ec0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions index.html
Expand Up @@ -20,6 +20,7 @@
JBrowse = new Browser({
containerID: "GenomeBrowser",
refSeqs: dataRoot + "/seq/refSeqs.json",
baseUrl: dataRoot+'/',
include: [
'jbrowse_conf.json',
dataRoot + "/trackList.json"
Expand Down
2 changes: 2 additions & 0 deletions src/JBrowse/Browser.js
Expand Up @@ -59,6 +59,8 @@ var Browser = function(params) {
this.isInitialized = false;

this.config = params;
if( ! this.config.baseUrl )
this.config.baseUrl = Util.resolveUrl( window.location.href, '.' ) + '/data/';

this.startTime = Date.now();

Expand Down
2 changes: 2 additions & 0 deletions src/JBrowse/Util.js
Expand Up @@ -169,6 +169,8 @@ Util = {
baseUrl = baseUrl.match(/.*\/\/[^\/]*/);
return (baseUrl ? baseUrl[0] : '') + relativeUrl;
}
// remove the query string from the base, if any
baseUrl = baseUrl.replace(/\?.*$/,'');
//TODO: handle protocol relative urls: ://www.domain.com
baseUrl = baseUrl.substring(0,baseUrl.length - baseUrl.match(/[^\/]*$/)[0].length);// clean off the trailing path
if (relativeUrl == '.')
Expand Down

0 comments on commit 8ce5ec0

Please sign in to comment.