Google Adsense inside a jquery dialog?

不想你离开。 提交于 2019-12-11 03:59:45

问题


I have a website that opens a dialog using jquery

function showDialogUser(url, options){
    if (!$('#myDialogUser').dialog('isOpen')) {
    $("#mydialogUser").dialog("close");
}
   options = options || {};
   var tag = $('#myDialogUser');
 //This tag will the hold the dialog content.
   $.ajax({
     url: url,
     type: (options.type || 'GET'),
     beforeSend: options.beforeSend,
     error: options.error,
     complete: options.complete,
     success: function(data, textStatus, jqXHR) {
       if(typeof data == "object" && data.html) { //response is assumed to be JSON
         tag.html(data.html).dialog({modal: options.modal, title: data.title, height: 550, width: 1000}).dialog('open');
       } else { //response is assumed to be HTML
    var matches = data.match(/<title>(.*?)<\/title>/);
        var spUrlTitle = matches[1];
         tag.html(data).dialog({modal: true, title: spUrlTitle, height: 560, width: 1000}).dialog('open');
       }
       $.isFunction(options.success) && (options.success)(data, textStatus, jqXHR);
     }
   });
}

It loads another page.asp file that contains a google adsense code.

The problem is that it is not displaying the ad.

When I try to access the page.asp on my browser the ad appear.

How can I do it ? I tried several ways but it didn't work

Thanks


回答1:


Google adsense won't work properly inside of a jQuery UI Dialog because it would require moving the adsense html, which could in turn generate invalid impressions, risking your account being closed.

I suggest against it.



来源:https://stackoverflow.com/questions/12229411/google-adsense-inside-a-jquery-dialog

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!