In this post some essential tips and recommendations for banners' and templates' mark up are listed. We recommend to create templates and edit banners' codes in accordance with these recommendations in order to make them work at any type of pages and devices.

Checking page's protocol

Requests to external resources from a web-page should be done using the same protocol as the page uses. It can be done by either checking the protocol using javascript:

document.write("<script type='text\/javascript' src='"+(location.protocol == 'https:' ? 'https:' : 'http:') + "//www.source.com\/getad.php?4654;999;300×250′><\/script>");

or using scheme-less relative URI approach:

<script type='text/javascript' src='//www.source.com/getad.php?4654;999;300×250′></script>

This applies to ads at web-pages only and does not regard application and e-mail ads.

Use only lower case letters for tags and attributes

XHTML language is case-sensitive and requires all tags and attributes to have lower-case letters and if a banner is served at an XHTML web-page it must follow this requirement to work properly.

Encoding

In order to encode a URI or a part of it use encodeURIComponent() function instead of outdated escape() function.

Getting current window URL

In order to get current location use window.location.href property instead of window.location, which is an object.

Getting referrer of a page

Avoid using the document.referrer property inside iframes or check if it is defined, e.g. if(document.referrer){//some action here}

JS code mark up

Add CDATA to avoid the content of a JS script to be parsed by XML parser at XHTML pages. Example:

<script>
//<![CDATA[

//some script here

//]]>
</script>

Always use closing tag

Your tags must always have both opening and closing tags in order to meet XHTML requirements, single tags should be closed with /> e.g:

<img src="http://sourcepage.com/pic.png" />

Cross-domain calls

Do not make calls from page (frame) with one domain to a page (frame) with another domain.

Publisher's page styling

If your banner is not displayed as expected, please check publisher's web-site for having any general css selectors like div{} or >div{}.

References and additional info

For more recommendations please read Transitioning to XHTML Strict in 10 Steps.

Need more help?

Should you require any additional help with our solutions, do not hesitate to contact Epom technical support at support@epom.com. Our support managers are dedicated to resolving any issues and providing you with solutions and support if you face difficulties or have questions.