Add Script Only to Home Page

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
12 years ago
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 years ago
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 years ago
Worked like a charm. Thank you!
10 years ago
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 years ago
It's the still same. Please open the mentioned files to see it
3 years ago
How to do this in 4.3 ?
3 years ago
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.