Title: Document Write Called After Page Load
Last modified: April 6, 2020

---

# Document Write Called After Page Load

 *  Resolved [casbboy](https://wordpress.org/support/users/casbboy/)
 * (@casbboy)
 * [6 years, 2 months ago](https://wordpress.org/support/topic/document-write-called-after-page-load/)
 * I am trying to auto insert an ad block after content, I actually select “footer”
   from dropdown.
 * I have Device selection, but when I choose Client Side, I get the errors like
   this:
 * “document.write called after page load”
 * And the ad can’t load.
 * I seem to have more success with server side detection, but my fear is that the
   detection will be cached by Cloudflare. So if detection is made that the user
   is mobile and loads the page that way with the ad set for mobile, Cloudflare 
   will cache that page with the ad for mobile.
 * Or do I not need to worry about cacheing? If that is the case, server side works.
   But would prefer to use client side, but the Document.Write error happens immediately
   upon activating that.
 * Cheers!
    Ryan
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fdocument-write-called-after-page-load%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 1 replies (of 1 total)

 *  Plugin Author [Spacetime](https://wordpress.org/support/users/spacetime/)
 * (@spacetime)
 * [6 years, 2 months ago](https://wordpress.org/support/topic/document-write-called-after-page-load/#post-12638371)
 * If you are using caching then you can’t use server side device detection:
    [https://adinserter.pro/documentation/device-detection](https://adinserter.pro/documentation/device-detection)
 * And when you use client side functions you can’t use codes that use `document.
   write` method:
    [https://adinserter.pro/documentation/troubleshooting#document-write](https://adinserter.pro/documentation/troubleshooting#document-write)

Viewing 1 replies (of 1 total)

The topic ‘Document Write Called After Page Load’ is closed to new replies.

 * ![](https://ps.w.org/ad-inserter/assets/icon-256x256.jpg?rev=1502039)
 * [Ad Inserter - Ad Manager & AdSense Ads](https://wordpress.org/plugins/ad-inserter/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ad-inserter/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ad-inserter/)
 * [Active Topics](https://wordpress.org/support/plugin/ad-inserter/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ad-inserter/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ad-inserter/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Spacetime](https://wordpress.org/support/users/spacetime/)
 * Last activity: [6 years, 2 months ago](https://wordpress.org/support/topic/document-write-called-after-page-load/#post-12638371)
 * Status: resolved