OMG Posted May 8, 2018 Report Posted May 8, 2018 Hello, we use Revive for serving our ads. Recently we switched to the "asynchronous JS-Tag" to improve page speed. After that it introduced a problem. Some of our Ads use "document.write" to display their content on the page. The Ads which use "document.write" throw now the following error: "Failed to execute 'write' on 'Document': It isn't possible to write into a document from an asynchronously-loaded external script unless it is explicitly opened." I understand that these Ads can't write their data in async mode but what is the solution or workaround? Any ideas? Quote
andrewatfornax Posted May 21, 2018 Report Posted May 21, 2018 As I understand it, asynchronous tags load banner content after the main document has been written, so, you cannot use document.write to put content into the main document, because it's already been written. See: https://stackoverflow.com/questions/24297829/execute-write-on-doc-it-isnt-possible-to-write-into-a-document-from-an-asynchr I think the work arounds are: 1. Don't use asynchronous tags; 2. Use a different mechanism for writing the banners other than document.write; or 3. We look at using something like https://github.com/krux/postscribe I'll raise the idea of #3 with the core team. Quote
Matteo Beccati Posted May 21, 2018 Report Posted May 21, 2018 @OMG I believe you just need to make sure that This banner can be safely displayed inside an iframe (e.g. is not expandable) is checked in the banner-edit screen. andrewatfornax 1 Quote
Dion Halcyon Posted October 31, 2022 Report Posted October 31, 2022 @Matteo Beccati having the same issue with @OMG, the problem is i don't want to use "This banner can be safely displayed inside an iframe (e.g. is not expandable) is checked in the banner-edit screen" option as it wraps my embedded code with <iframe> tag, it causes mobile responsive issues. Is there any alternative that we can use? Thanks. Quote
Matteo Beccati Posted October 31, 2022 Report Posted October 31, 2022 @Dion Halcyon Sorry, document.write() is extremely bad and destructive and should be avoided. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.