JavaScript pre-execute

90 views
Skip to first unread message

Joel Kinzel

unread,
Jul 9, 2012, 1:16:34 PM7/9/12
to reddot-c...@googlegroups.com
All,

I've talked with OT Support and Jian (who many know and who also frequents the board) suggested we use JavaScript for pre-execute whenever possible. So I took his advice and in a project I'm working on now, I'm using jQuery to make an ajax call to get content from a different page. The "problem" that I now have is there is a slight delay when the users load the page, where the ajax call happens, and then the content gets inserted into the page. I've wrapped the script block in the pre-execute tags and make sure .js was a valid pre-execute extension in the project settings. What am I missing to make this happen BEFORE the rendered page is sent to the user's browser? 

Thanks in advance.

Joel Kinzel

unread,
Jul 9, 2012, 1:49:05 PM7/9/12
to reddot-c...@googlegroups.com
This is a response from the great Jian himself: 

JavaScript don't have to be preexecuted because it is a client side language rather than server side language.

The code runs as soon as the browser loads the code.  Unless you specifically coded it so it runs after the entire page finishes loading.

Reason we recommend JavaScript over preexecution is to off load server side load to client side, hence making the MS server able to support more concurrent users/publishing.

If you are using AJAX to load information from another page, the best practice is to have a loading message prior to display of content.

So it looks like there isn't really a way to get this to fire prior to having the page completely loaded, except for not using a .ready or equivalent.  
Reply all
Reply to author
Forward
0 new messages