• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.2 BuySellAds responsive - will this work?

Mouth

Well-known member
#1
www.BuySellAds.com does not support responsive sites, as they use < div > for their ad injection.
I wondered if this would work to deliver different size ad assets based on browser width?

Code:
<SCRIPT LANGUAGE="javascript">
if (window.innerWidth <= 320) {
  document.write("<div>phone/small size ad</div>");
} else if (window.innerWidth <= 768) {
  document.write("<div>tablet/medium size ad</div>");
} else {
  document.write("<div>desktop/full size ad</div>");
}
</SCRIPT>