function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ajax-theikosajax-theikos 

My scontrol is not woking in InernetExplorer.(IE). But Works on Mozilla firefox

hi , i am trying to run this scontrol in IE. But i get sforce object is not defined.

 here i am giving my code. please help me

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
<SCRIPT
src="http://na1.salesforce.com/soap/ajax/8.0/connection.js"
type=text/javascript></SCRIPT>
<script language="javascript">
 var opportunityStage = '{!Opportunity.StageName}';
 var oppId = '{!Opportunity.Id}';
 

function init()
{
   sforce.connection.init("{!API.Session_ID}","{!API.Partner_Server_URL_70}");
   alert("login");
    window.parent.location.href = "https://na3.salesforce.com/"; 
}

 

</script>
</head>
<body class="account detailPage" topmargin="0" leftmargin="0"
onLoad="javascript:init()">

</body>
</html>

 

Doug ChasmanDoug Chasman
Can you tell us how you are accessing this scontrol (e.g. inlined into a detail page, from a weblink/webtab or a an external iframe/url that you've created outside of salesforce in your own site)?

Thanks,
Doug
DevAngelDevAngel
With the 8.0 Ajax toolkit you don't need to call the init function.  Not sure if this has anything to do with your stated issue, but thought you might like to know.
cheenathcheenath
There is no need to login, or call init() on connection when the toolkit is used within an scontrol.

Also, it is better to include relative URL instead of the full URL for connection.js

Instead of:

src="http://na1.salesforce.com/soap/ajax/8.0/connection.js"

use this URI:

src="/soap/ajax/8.0/connection.js"
michaelforcemichaelforce

it could be the URL redirection...  try putting "top" in front of it just to be safe:

top.window.parent.location.href = "yadda yadda yadda"

michaelforcemichaelforce

Also... you may need to add "opener" in there depending on the situation, like so:

window.parent.opener.location.href='yadda';

As you can tell, I'm a 'trial and error' type of guy :smileytongue: