Skip to main content
Nintex Community Menu Bar
Question

inline javascript not running on salesforce site

  • Jul 10, 2024 8:44 PM UTC
  • 12 replies
  • 80 views
  • Translate All

Forum|alt.badge.img+18

This inline javascript:

(function(skuid){<br>var $ = skuid.$;<br>$(document.body).one('pageload',function(){<br> &nbsp; &nbsp;console.log('Page Loaded');<br>});<br>})(skuid);


When I run the page with the skuid preview, it works fine. When I run it visual force on a salesforce Site, the code doesn’t execute and my console is blank.

12 replies

Forum|alt.badge.img+18
  • Author
  • Jul 10, 2024 9:31 PM UTC

I’m on skuid 8.15.15

Translate

Forum|alt.badge.img+2

$(document.body).one(

should be 

$(document.body).on(

Translate

Forum|alt.badge.img+18
  • Author
  • Jul 10, 2024 9:31 PM UTC

Thanks, Pete. Neither works.

Translate

Forum|alt.badge.img+2

try:

$(document).ready(function() {
    console.log(“hello world”);
});

Translate

Forum|alt.badge.img+2

try

$(document).ready(function(){
    console.log(‘page loaded’);
});

Translate

Forum|alt.badge.img+18
  • Author
  • Jul 10, 2024 9:31 PM UTC

No, the problem is not the ready function itself. The problem is that the script isn’t being called at all.

Translate

Forum|alt.badge.img+18
  • Author
  • Jul 10, 2024 9:31 PM UTC

Skuid-- any ideas on this?

I have an inline javascript resource like the following, which runs fine in salesforce but on on a salesforce site:

(function(skuid){<br>&nbsp; &nbsp; console.log('script loaded');<br>})(skuid);

Translate

Forum|alt.badge.img+7

Matt,

Try using $(“.nx-page”).one(“pageload”,function() { instead of $(document.body).one(‘pageload’,function(){ - oh, just realized you said the snippet isn’t getting called at all, so that won’t help you. Do you see any errors in the browser console?

Translate

Forum|alt.badge.img+18
  • Author
  • Jul 10, 2024 9:31 PM UTC

No errors in the console.

Translate

Forum|alt.badge.img+18
  • Author
  • Jul 10, 2024 9:31 PM UTC

Is there something about force.com sites that I need to do differently? Is there some kind of security setting that could be getting in the way?

Searching through the salesforce documentation and forums hasn’t gotten me anywhere.

Translate

Forum|alt.badge.img+6

Matt,

did you work out what this problem was (3 years ago…) I seem to have the same problem although a snippet I have is running on the SF page but an inline script is not, I can see it as a resource in the page but no execution, no errors.

Any guidance much appreciated

Ben,

Translate

annajosephine
Nintex Employee
Forum|alt.badge.img+18
  • Nintex Employee
  • Jul 10, 2024 9:31 PM UTC

Hey Ben, what version of Skuid are you using? Are you building in api V1 or v2?

To confirm, are you seeing the issue just in the Force.com Site, or also when you preview the page from the App Composer?

Translate