Jump to content

Issues with Revive Asynchronous JS-Tag and ads using document.write

Recommended Posts


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?

Link to comment
Share on other sites

  • 2 weeks later...

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.

Link to comment
Share on other sites

  • 4 years later...

@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?



Link to comment
Share on other sites

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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...