Questions on using scripts

If you have questions about using mojoPortal, you can post them here.

You may want to first review our site administration documentation to see if your question is answered there.

This thread is closed to new posts. You must sign in to post in the forums.
10/4/2017 12:15:21 PM
Gravatar
Total Posts 2

Questions on using scripts

Hi,

New user of mojoPortal. I have a couple questions. 

1) is there a way to make scripts load asynchronously?

2) If there is not, can I move my scripts to the footer area of the HTML? I tried moving this code:

<portal:ScriptLoader ID="ScriptLoader1" runat="server" IncludeJQueryMigrate="true" />
<portal:SkinFolderScript ID="sfs1" runat="server" ScriptFileName="script.js" AddToCombinedScript="false" />
<portal:SkinFolderScript ID="sfs2" runat="server" ScriptFileName="script.responsive.js" AddToCombinedScript="false" />

to the footer and none of the JS worked then.

Thanks!
Colin

10/4/2017 5:27:57 PM
Gravatar
Total Posts 92

mojoPortal Hosting & Design @ i7MEDIA!

Re: Questions on using scripts

Hi,

First off, it sounds like you're using an Artisteer skin. If you're creating a new skin I would suggest you start with a Framework based skin from our mojoSkins project. It supports all the latest features and has all the latest bug fixes.

Making a script async can be an issue if it's dependent on another script, as it will cause script errors if the dependency loads after the async script.

That being said, SkinFolderScripts can be moved and set as async. You can make the SkinFolderScript load wherever the control is placed by setting RenderInPlace="true" on the control.

For example:

<portal:SkinFolderScript runat="server" ScriptFileName="script.js" RenderInPlace="true" />

To set the script as async set the ScriptRefFormat attribute to something like this:

<portal:SkinFolderScript runat="server" ScriptFileName="script.js" RenderInPlace="true" ScriptRefFormat="<script src='{0}' async></script>" />

Again, use extreme caution with this setting.

The ScriptLoader itself is for configuration of many scripts that mojo manages in that specific skin, moving it physically won't change where those scripts are rendered.  Right now there are several scripts that need to load in the head of the document so moving them is not an option. We will be looking into cleaning and optimizing this in the future.

I would suggest you look at our Framework project as a place to start as we have done much of what I've already described.

Thanks,
Elijah

10/5/2017 9:58:02 AM
Gravatar
Total Posts 2

Re: Questions on using scripts

Elijah,

Thank you very much for the info! 

I inherited this site and did not create it. So I'm trying to fix some issues with it.

Thanks again,
Colin

 

You must sign in to post in the forums. This thread is closed to new posts.