Is it possible to adjust the actual HTML tag to include additional attributes on a single page?

Ron Rainey asked on October 1, 2020 23:41

We have a 3rd party vendor that needs a page with just our header so they can scrape it into an iFrame(I know right). I made a page with a new master template that includes just our header, but the vendor requires us to add data-iframe-height="" to the HTML tag itself.

I can not find a way to do this for just this page and template. How can I change the default HTML envelope attributes?

Correct Answer

David te Kloese answered on October 2, 2020 10:31

Not the most elegant way, but does the job and makes sure it's specific to just that 1 master page template.

add this to the layout of that specific Master Page:

<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
      CMS.UIControls.ContentPage page = this.Page as CMS.UIControls.ContentPage;
      if(page != null)
      {
          page.XmlNamespace += " data-iframe-height=\"123\"";
      }
}
</script>

Should look somewhat like:

config on template

1 votesVote for this answer Unmark Correct answer

   Please, sign in to be able to submit a new answer.