Included StaticResource javascript cannot call RemoteAction

I am trying to call a RemoteAction in an Apex Component. Every time I get the error ‘unable to invoke action, no controller and/or method found’. I have reduced the function to one with only 1 string argument, and just pass down ‘hello’ when I call it, but it still does not work.

I am wondering if it has something to do with the fact that when the page loads I see this error from VFRemote.js

 Uncaught SecurityError: Blocked a frame with origin ""
 from accessing a frame with origin "". Protocols, domains,
 and ports must match. 

I had similar problems with actionfunctions, where they would not do anything if called from an included StaticResource. I am wondering if it is because the scripts and components are served from, while the api is at


You should use $Resource global variable when referencing static resources.

From salesforce docs:

It’s a best practice to reference static resources by using the
$Resource global variable and the URLFOR() function instead of static
strings. For example:

<apex:includeScript value="{!$Resource.MyJavascriptFile}"/>
<apex:image url="{!URLFOR($Resource.TestZip, 'images/Bluehills.jpg')}" width="50" height="50"/>

If you include your javascript resource using Resource or urlfor, it should resolve that error.

Source : Link , Question Author : Alex H , Answer Author : Anup

Leave a Comment