This is driving me nuts. I have the most simple JSRemoting setup and for whatever reason I can not get this VF page to render on my Contact Layout. It's giving me a cross domain error and the only way that I can fix it seems to be to remove the @RemoteAction annotation from the controller/extension. I searched the net and saw other people were able to remote from a standard layout and I thought JSRemoting was supported in this use case?

Anyway, I'm getting this error from the console :

Uncaught SecurityError: Blocked a frame with origin "https://c.cs20.visual.force.com" from accessing a frame with origin "https://cs20.salesforce.com". Protocols, domains, and ports must match.

Even if I am not referencing the remote action I get it but if I remove the @RemoteAction annotation, the error goes away.

Any help would be greatly appreciated. Here is the super simple code I'm trying to use :

<apex:page applyHtmlTag="false" standardStylesheets="false" controller="jrTesting" 

showHeader="false" >
 <script type="text/javascript" src="{!URLFOR($Resource.Bootstrap3, 'bootstrap_3.1.1/js/jquery-1.11.0.min.js')}"/><apex:messages />
<p id="ts" >This is my paragraph...</p>

<script type="text/javascript">

var $j = jQuery.noConflict();
$j(document).ready(function() {


$j("#ts").text("New Text here!");

function callRA() {
            function(r, e){           


function callRA2() {
jrTesting.getTheString(function(r, e){           
             $j("#ts").text(r + ' from number 2!');  




controller :

public with sharing class jrTesting {

    public jrTesting() {


    public static string getTheString() {
        return 'Here is my return string';


**UPDATE To access it, the class and methods need to be global!**

2 Answers 2


Thanks for your response, @Regal. Well, after reading further, I am a dummy! Apparently you have to make your class and method Global! Anyway, for anyone else out there banging their head on the table about this, you can find the answer in the JSRemoting documentation here

@RemoteAction Scope Visualforce Page    Non-Global Component    Global Component    

Global Remote Method    Allowed Allowed Allowed Allowed
Public Remote Method    Allowed Allowed Error   Error

As the error says: The remoting url of the visualforce page is different from the url of Standard layout page So, browser security do not allow this cross domain request.

Visualforce remoting is a stateless ajax call which cannot be happened to different url,port or protocol from the url in which it initiated.

You can see remote url is: https://c.cs20.visual.force.com/ and page url is https://cs20.salesforce.com/ They have different domains. To make this call successful, domain,protocol and port must be same.

I would recommend to use <apex:actionfunction> if you can use Apex controller on visualforce page.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .