Re: Is there a method to add HTML Markup eg before </head>

Tim Plumb

Hi Anthony,
Although you can't currently add markup items to your Xway page output you can add a simple JavaScript function that will add these for you. I did something similar on this test page I put together last week although the code I used was quite specific to the items I wanted to load. Specifically the script loaded jQuery and the Font Awesome fonts.

Below is a rewritten function that should work with any markup items you want to add to your page. Simply copy and paste the code below into your Xway inspector in the JavaScript Markup section.
The part you will need to edit starts with the 'Add your code here' comment.
Each block of code you want to add should be in the format;
xAdd('Your HTML code here');
with 'Your HTML code here' obviously replaced by the code you want to add.
By default this will add the code to the page <head>. If you want to add it to the page <body> simply add on a second parameter called 'body' like this;
xAdd('Your HTML code here','body');
Just make sure that you don't add single quotes (') in your HTML code and you should be OK.

function xAdd(e,n){var d="head";"body"==n&&(d="body");var t=document.createElement("div");t.innerHTML=e,t.querySelectorAll("*").forEach(function(e){document.getElementsByTagName(d)[0].appendChild(e)})}
window.onload = function(){
/* Add your code here */
/* Add code to the page head */
xAdd('<link rel="icon" type="image/png" href="">');
/* Add code to the page body */
xAdd('<span>This is a span added to the page body</span>','body');

Join to automatically receive all group messages.