1

I am using List button in Listview as content source of OnClickJavascript, here am using three custom buttons one button is working perferctly. But another two buttons are not working in Chrome, these three buttons are working fine in Firefox. This is my script:

"{!REQUIRESCRIPT('/soap/ajax/29.0/connection.js')} 
{!REQUIRESCRIPT('/soap/ajax/29.0/apex.js')} 
{!REQUIRESCRIPT('http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js')} 

var records = {!GETRECORDIDS($ObjectType.Sample__c)}; 
var prodRecorIds= ""; 

if (records[0] == null) { 
alert("You have not selected any record."); 
} else { 
for (i = 0; i < records.length; i++) { 
prodRecorIds += records[i]+","; 
} 
sforce.apex.execute("Controller","method",{prodids:"{"+prodRecorIds+"}"}); 
window.location.reload(); 
}"

Here i need to add any browser supporting script? Is there any solutions to resolve this?

Thanks Venkatsforce

  • What doe the JavaScript console in Chrome say? It should throw an error. – Daniel Hoechst Dec 13 '14 at 3:09
  • No it doesn't throw the error..when i click the button no action occurs.. – Venkatsforce Dec 13 '14 at 3:19
  • Does your button text have the double quotes at the beginning and the end? That shouldn't be there. – Daniel Hoechst Dec 13 '14 at 3:20
  • No it doesn't, one button is working perfect but other buttons are not working same script am using in this section.. – Venkatsforce Dec 13 '14 at 3:23
  • 1
    So change the http to https in the require script function. – Daniel Hoechst Dec 13 '14 at 6:48
2

Chrome is blocking the insecure request to http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js. Either change it to https or remove that line since you aren't using jQuery in your code anyways.

0

Update the code where you are populating the JS records object using a server side function. You generally enclose all server side functions or variables in single quotes while trying to access them in Javascript. The updated code should be.

var records = '{!GETRECORDIDS($ObjectType.Sample__c)}';

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.