Jump to content

tfeuerst

Approved members
  • Posts

    2
  • Joined

  • Last visited

Posts posted by tfeuerst

  1. Hi all,

    I'm trying to display a zone within a responsive Webpage only on a certain minimum width.
    With the synchronous JavaScript code I did the following:

    <script type='text/javascript'>
        var width = window.innerWidth || document.documentElement.clientWidth;
        if (width >= 1050) {
            var m3_u = (location.protocol=='https:'?'https://.../live/www/delivery/ajs.php':'http://.../live/www/delivery/ajs.php');
            var m3_r = Math.floor(Math.random()*99999999999);
            if (!document.MAX_used) document.MAX_used = ',';
            ... and so on ...
        }
    </script>

    Now I want to do same thing with the acynchronous code. But the following won't do, because of script tag within script tag.

    <script type='text/javascript'>
        var width = window.innerWidth || document.documentElement.clientWidth;
        if (width >= 1050) {
            <ins data-revive-zoneid="1" data-revive-id="f2a4f2a33e1fd01dd1a2a1bf15f09405"></ins>
            <script async src="//.../live/www/delivery/asyncjs.php"></script>
        }
    </script>

    To use document.write feels wrong, because I loose the advantage of the acynchronous code.

    <script type='text/javascript'>
        var width = window.innerWidth || document.documentElement.clientWidth;
        if (width >= 1050) {
            document.write ("<ins data-revive-zoneid='1' data-revive-id='f2a4f2a33e1f465462a1bf15f09405'></ins>");
            document.write ("<scr"+"ipt async src='//.../live/www/delivery/asyncjs.php'");
            document.write ("><\/scr"+"ipt>");
        }
    </script>


    Does anybody have a solution for that?

    Thanks in advance.

     

×
×
  • Create New...