Skip to content
This repository has been archived by the owner on Jan 10, 2024. It is now read-only.

Fix IE incorrect parameter errors on VF pages #90

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions forcetk.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,17 @@ if (forcetk.Client === undefined) {
this.asyncAjax = true;
};

/**
* Creates an AJAX request object. Can be overridden for particular implementations.
*/
forcetk.Client.prototype.getXHR = function () {
if (window && window.Sarissa && window.Sarissa.originalXMLHttpRequest) {
return new window.Sarissa.originalXMLHttpRequest();
} else {
return new XMLHttpRequest();
}
};

/**
* Set a refresh token in the client.
* @param refreshToken an OAuth refresh token
Expand Down Expand Up @@ -211,7 +222,7 @@ if (forcetk.Client === undefined) {
'use strict';
var that = this,
url = (this.visualforce ? '' : this.instanceUrl) + path,
request = new XMLHttpRequest();
request = this.getXHR();

request.open("GET", (this.proxyUrl !== null && !this.visualforce) ? this.proxyUrl : url, true);
request.responseType = "arraybuffer";
Expand Down Expand Up @@ -290,10 +301,10 @@ if (forcetk.Client === undefined) {
+ "Content-Disposition: form-data; name=\"" + payloadField
+ "\"; filename=\"" + filename + "\"\n\n",
payload,
"\n\n"
"\n"
+ "--boundary_" + boundary + "--"
], {type : 'multipart/form-data; boundary=\"boundary_' + boundary + '\"'}),
request = new XMLHttpRequest();
request = this.getXHR();

request.open("POST", (this.proxyUrl !== null && !this.visualforce) ? this.proxyUrl : url, this.asyncAjax);

Expand Down