简体   繁体   中英

Load a php file based on screen resolution (js)

Trying to load different adsense ad units based on screen resolution. So, what I've done is , i've put different adsense units into different php files, and here is a js i'm trying to use.

if ($(window).width() > 1435 ) {
        $(".adinsert1").load("../addesk1.php");
        $(".adinsert2").load("../addesk2.php");
        $(".adinsert3").load("../addesk3.php");
    }
     else  {
        $(".adinsert1").load("../admob1.php");
        $(".adinsert2").load("../admob2.php");
        $(".adinsert3").load("../admob3.php");
     }

And it doesn't display anything

You must first check the AdSense policies and see whether your site fulfills all their expectations. Next, you must make sure that you wait for a few minutes after you have first integrated the system. If you still have a problem, then you should contact AdSense for information. You should check whether Javascript is enabled in the browser you are testing at and that there are no Javascript errors. Also, make sure that your code for displaying AdSense ads is accurate. Last, but not least, make sure that your JS function called load requests the server correctly, it gets the correct response and the response is correctly displayed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM