You need to sign in to do that
Don't have an account?

cross domain https XMLHttpRequest call
Facing a certain issue on internet explorer while custom integrating skipjack with salesforce.
1. On posting a visual force page form from IE 6.0 to https://developer.skipjackic.com/scripts/evolvcc.dll?AuthorizeAPI" we get “Permission Denied” error
2. On Posting a form from Firefox 2.0.0.12/Mozilla the same form gets posted but with a popup to Allow or Deny the form post .
3. The function PostForm(sVars) below is called on a button click which sends the request through an XMLHttpRequest call to the sjipjack server
The error on IE is due to a cross domain call by the XMLHttpRequest object on line xmlHttp.open("POST",url,false);
4.
The javascript code inside the form that makes this work is
<script src="/soap/ajax/8.0/connection.js"></script>
<script src="/soap/ajax/8.0/apex.js"></script>
<script language="javascript" type="text/javascript">
//make call to skipjack server through xmlHttpRequest object
function PostForm(sVars)
{
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
{
alert ("Your browser does not support AJAX!");
return;
}
var url="https://developer.skipjackic.com/scripts/evolvcc.dll?AuthorizeAPI";
alert(sVars);
alert("beforesent");
xmlHttp.onreadystatechange=stateChanged;
//check browser
var IE = document.all?true:false
// If NS -- that is, !IE -- then set call netscape.security
if (!IE)
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
}
xmlHttp.open("POST",url,false);
xmlHttp.setRequestHeader("Content-Type",
"application/x-www-form-urlencoded");
xmlHttp.send(sVars);
alert("sent");
}
function GetXmlHttpObject()
{
var xr=null;
if(window.XMLHttpRequest) //if browser is mozilla/firefox
{
try
{
xr=new XMLHttpRequest();
}
catch(e){alert(xr);
}
}
Else //if browser is IE
{
if(window.ActiveXObject)
{
try
{
xr=new ActiveXObject("Microsoft.XMLHTTP");
}
catch(e)
{
}
if(!xr)
{
try
{
xr=new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e)
{
}
}
}
}
return xr;
}
</script>
It's just not possible to do go directly cross domain from the client with either IE or FireFox... at least as far as I know.
Here is a link to some decent information, maybe you will find it helpful.
http://developer.yahoo.com/javascript/howto-proxy.html
http://wiki.apexdevnet.com/index.php/Ajax_Proxy