How to add code to head of specific page
How to add code to head of specific page
We are trying to add some code from FB for a campaign that our SM person is running, but it requires us to put some code in the HEAD section of the final checkout page (Payment.ascx). We can easily add the code inside of a HEAD section, but that will give two head tags, which is probably sloppy code. Is there a way to add something to the head section on just this page?
Rick Morris
Brewhaus (America) Inc.
Hot Sauce Depot
Brewhaus (America) Inc.
Hot Sauce Depot
-
- Commodore (COMO)
- Posts: 436
- Joined: Tue May 07, 2013 1:59 pm
Re: How to add code to head of specific page
There may be a much easier way to accomplish this than what I have below, so if there is hopefully someone else will answer.
Caution: I did a very simple test and the following seemed to work, but I am still on R5. This assumes that Payment.aspx has a master page of /Layouts/Fixed/Checkout.master, which in turn has a master page of /Layouts/Fixed/Base.master, which already has this:
in it.
The Layouts/Fixed/Base.master file has a content place holder for the html header called "HtmlHeader". In the Layouts/Fixed/Checkout.master file, you could add a content section that refers to that, and provides another content place holder that could be used by Payment.aspx.
So checkout.master would have something like this right after the <%@.... lines at the top:
Payment.aspx would have something like this right after the <%@.... lines at the top:
YMMV 
Caution: I did a very simple test and the following seemed to work, but I am still on R5. This assumes that Payment.aspx has a master page of /Layouts/Fixed/Checkout.master, which in turn has a master page of /Layouts/Fixed/Base.master, which already has this:
Code: Select all
<asp:ContentPlaceHolder ID="HtmlHeader" runat="server">
</asp:ContentPlaceHolder>
The Layouts/Fixed/Base.master file has a content place holder for the html header called "HtmlHeader". In the Layouts/Fixed/Checkout.master file, you could add a content section that refers to that, and provides another content place holder that could be used by Payment.aspx.
So checkout.master would have something like this right after the <%@.... lines at the top:
Code: Select all
<asp:Content ID="HtmlHeader2" runat="server" ContentPlaceHolderID="HtmlHeader">
<asp:ContentPlaceHolder ID="HtmlHeader3" runat="server"></asp:ContentPlaceHolder>
</asp:Content>
Code: Select all
<asp:Content ID="MyCustomHtmlHeadStuff" runat="server" ContentPlaceHolderID="HtmlHeader3">
<%-- anything in this content area will be inserted in the HTML <head> element --%>
</asp:Content>

Jay
Re: How to add code to head of specific page
That appears to work (and I am on R8, so I assume that it will work for anyone on a Gold version). Thanks for the help! 

Rick Morris
Brewhaus (America) Inc.
Hot Sauce Depot
Brewhaus (America) Inc.
Hot Sauce Depot