File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -53,11 +53,12 @@ if (forcetk.Client === undefined) {
5353 this . sessionId = sessionId ;
5454 this . proxy_url = location . protocol + "//" + location . hostname
5555 + "/services/proxy" ;
56- // location.hostname is of the form 'abc.na1.visual.force.com', so we
57- // can simply split it on '.' and take the second element of the
58- // resulting array
59- this . instance_url = "https://" + location . hostname . split ( "." ) [ 1 ]
60- + ".salesforce.com" ;
56+ // location.hostname can be of the form 'abc.na1.visual.force.com' or
57+ // 'na1.salesforce.com'. Split on '.', and take the [1] or [0] element
58+ // as appropriate
59+ var elements = location . hostname . split ( "." ) ;
60+ var instance = ( elements . length == 3 ) ? elements [ 0 ] : elements [ 1 ] ;
61+ this . instance_url = "https://" + instance + ".salesforce.com" ;
6162 this . apiVersion = ( typeof apiVersion === 'undefined' || apiVersion == null )
6263 ? 'v21.0' : apiVersion ;
6364 }
You can’t perform that action at this time.
0 commit comments