Add Script Only to Home Page

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
12 năm cách đây
NC 2.4 - I need to add a reference to a script that will only be used on the home page. Is there a way to reference the script so that only the home page loads it. I don't want to load on every page throughout the site when it isn't necessary. Thank you for your help.
12 năm cách đây
Use @Html.AddScriptParts() help method in the \Views\Home\Index.cshtml file
P.S. For example, have a look at the \Views\PrivateMessages\Index.cshtml file
12 năm cách đây
Worked like a charm. Thank you!
10 năm cách đây
I'm trying to do the same thing in v3.0, but it doesn't seem to be working. Is there a different way to do it in v3.0?
10 năm cách đây
It's the still same. Please open the mentioned files to see it
3 năm cách đây
How to do this in 4.3 ?
3 năm cách đây
Still very similar
Html.AddScriptParts(ResourceLocation.Footer, "~/js/public.estimateshipping.popup.js");
See source\Presentation\Nop.Web\Views\Shared\_EstimateShippingPopUp.cshtml
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.