Skip to content

Commit 13526aa

Browse files
committed
Changes to accomodate CORS support
Added the ability to operate with no proxy, if the user chooses to do so, assuming they have CORS support enabled
1 parent f766bb0 commit 13526aa

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

forcetk.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,13 @@ if (forcetk.Client === undefined) {
5757
if (location.protocol === 'file:' || location.protocol === 'ms-appx:') {
5858
// In PhoneGap
5959
this.proxyUrl = null;
60-
} else {
60+
} else if (location.hostname.indexOf('force.com')>-1){
6161
// In Visualforce - still need proxyUrl for Apex REST methods
6262
this.proxyUrl = location.protocol + "//" + location.hostname
6363
+ "/services/proxy";
64+
} else {
65+
//This means we are running locally, or on an external server, and we have CORS enabled (hopefully)
66+
this.proxyUrl=null;
6467
}
6568
this.authzHeader = "Authorization";
6669
} else {

0 commit comments

Comments
 (0)