Page 1 of 1

Modify the HTML Head

Posted: Wed Mar 25, 2015 2:39 pm
by webmaz
Hello
Could someone point me in the right direction for how to add code to the HTML head of every page?
Also, where would I add code to the HTML head of the receipt page only? While I'm asking, how about other checkout pages like Basket.aspx or OPC.aspx?
I do see in the Admin where to add code to the HTML head of a specific page (homepage, product page or a category page for example), but it seems to be different for certain pages.

Thanks!

Re: Modify the HTML Head

Posted: Thu Mar 26, 2015 1:05 am
by mazhar
If you want script to be on all pages then you can add it to layout files. In Layout/Base.master and Layout/Fixed/Base.master. If you just want it on all checkout pages then you can try adding script to Layout/Fixed/Checkout.master by adding another content control somthing like that

Code: Select all

<asp:Content ID="HeaderScripts" ContentPlaceHolderID="HtmlHeader" runat="server">
    <script language="javascript" src="~/yourscript_here.js" type="text/javascript" ></script>
</asp:Content>

Re: Modify the HTML Head

Posted: Thu Mar 26, 2015 7:22 am
by webmaz
This has been helpful. Thanks!

Is there a way to add a script to the HTML head of Receipt.aspx only?

Thank you.

Re: Modify the HTML Head

Posted: Thu Mar 26, 2015 7:51 am
by mazhar
Well for that edit Layout/Fixed/Account.master and add following to it

Code: Select all

<asp:Content ID="HeaderScripts" ContentPlaceHolderID="HtmlHeader" runat="server">
    <asp:ContentPlaceHolder ID="HtmlHeadScripts" runat="server">
    </asp:ContentPlaceHolder>    
</asp:Content>
then edit Reciept.aspx and add following to it

Code: Select all

<asp:Content ID="HeaderScripts" ContentPlaceHolderID="HtmlHeadScripts" runat="server">
    <script language="javascript" src="~/yourscript_here.js" type="text/javascript" ></script>
</asp:Content>
Now you should be able to add script this way to any page that uses Account.master layout.