volume_up

A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More

volume_up

A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More

ClientResources.RequireScript().AtFooter() not working

What area name does the .AtFooter() method look for? I have @Html.RequiredClientResources("Footer") in my master page, but my script is added to the page even when using .AtFooter(). The only documentation I can find on this whole feature shows the use of @Html.RequiredClientResources(RenderingArea.Footerbody) but I can't find anywhere where RenderingArea.Footerbody is defined.

#139890
Oct 09, 2015 0:44
Vote:

Hi, 
looks correct to me. Make sure that you've put '@Html.RequiredClientResources("Footer")' at the bottom of the layout view though, as the scripts will be rendered at the location where you've put it.

#139901
Oct 09, 2015 8:57

Thanks for your response, Per. I have declared the footer area just before the closing body tag. Here is some of my markup:

_Blank.cshtml Layout:

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title></title>
    @Scripts.Render("~/bundles/js")
    @Html.RequiredClientResources("Header") @*Enable components to require resources. For an example, see the view for VideoBlock.*@
</head>
<body>
    <div>
        @RenderBody()
    </div>
    @Html.RequiredClientResources("Footer")
</body>
</html>


Page:

@model PageViewModel<CampWeekAdminPage, CampWeekAdminViewModel>

@{
    Layout = "~/Views/Shared/Layouts/_Blank.cshtml";
    EPiServer.Framework.Web.Resources.ClientResources.RequireScript("/ClientResources/js/jQuery/jquery.tlgi.validation.js").AtFooter();

    var cwVM = Model.ViewModel;
}

Yesterday, right before I left, the script was appearing in the <head> section when rendered, even after rebuilding the project and doing a hard refresh on the page. Now, when I just ran it to confirm it's not working, it's now appearing at the footer. Something must have been cached. Where or how it got cleared, I don't know. Thanks for confirming all was correct.

#139925
Oct 09, 2015 17:49
error This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.