当回传为空时隐藏外部Iframe Criteo异步标记

时间:2016-01-13 15:12:02

标签: jquery asynchronous iframe external criteo

希望有人可以帮助我们。我们需要隐藏一个外部iframe,而不会在没有加载横幅的情况下创建异步Criteo标记创建的回传(导致空白空格)。任何的想法?

这是标签:

    <div id="one" margin="0px">
    <script>
    var cto_zoneid_desktop = "xxxxxx";
    var cto_zoneid_mobile = "xxxxxx";
     var cto_lim_w = 700,cto_lim_h = 200,cto_zoneid_selected = cto_zoneid_desktop;
    if( window.screen.width<window.cto_lim_w || window.screen.height<window.cto_lim_h){cto_zoneid_selected = cto_zoneid_mobile;}
    var crt_curl = '#CLICK_URL_UNESC#';
    (function(w,d,s,c,z,u){var f=d.getElementsByTagName(s)[0],
    j=d.createElement(s),l = '&loc=' + encodeURIComponent(w.location), r = d.referrer ? '&referer=' + encodeURIComponent(d.referrer) : '', g = u.substring(0,4) == 'http' ? '&ct0='+encodeURIComponent(u) : '', cb="&cb="+Math.floor(Math.random()*99999999999) ;j.async='true';j.src=(("https:"==location.protocol?"https:":"http:")+
    '//cas.criteo.com/delivery/ajs.php?zoneid='+z+'&containerid='+c+g+l+r+cb).substring(0,2000);f.parentNode.insertBefore(j,f);
    })(window,document,'script','one',cto_zoneid_selected,crt_curl);
    </script>
    </div>

1 个答案:

答案 0 :(得分:0)

我找到了一个解决方案,可以在没有横幅的情况下隐藏来自Criteo的iframe。将以下代码放回传递中:

public void GetQuote(QuoteData data)
{
    using (Database db = new Database())
    {
        var result = CalculateResult(db, data);

        byte[] pdfByte = (result.Data.PDF);
        var pdf = new PDF { PDFbyte = pdfByte, CustomerId = result.Data.CustomerId };
        db.PDF.Add(pdf);

        //Here
        int rfqLast = (from x in db.Quote where x.MKCRFQ != null orderby x.Id descending select x.MKCRFQ).Take(1).SingleOrDefault();
        var rfqAdd = new Quote { MKCRFQ = rfqLast + 1 };

        result.Quote.MKCRFQ = rfqAdd.MKCRFQ;

        db.Quote.Add(result.Quote);
        db.SaveChanges();
    }
}

有效。希望它可以帮助别人。