• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Not a bug "Async Ads Codes" have a Problem while "reply a thread on quick reply"

maxicep

Active member
#1
Hello,

Our problem is that;
If we put the async ad codes in the ad_message_body or ad_message_below templates and someone reply the thread via quick reply, thread doesn't update with new content and post doesn't show on thread page. Users should refresh for see them.

We have 2 different async adsense code in our forum. They are:
1. every first post in threads (all pages of thread)
2. every second post in threads (all pages of thread)

So if we edit the the first or second post of thread or second post of thread inline, then it disappear and we cant see them until the refresh page. However, if someone reply the thread and if this reply the new first or second post of thread's pages then same problem. Post cant show and ajax loader waiting at right of the corner of the screen.

I have searched this problem in xenforo, and i found same problem from others;
https://xenforo.com/community/threa...-post-would-start-a-new-page-in-thread.95166/

He says that, if switch to normal code and remove the async code, post replies works without problem but i cant switch now because responsive adsense codes have no standart code, they are async only.

I think it is a xenforo's bug and it should be fixed.
 

HWS

Well-known member
#2
We also experienced this problem long time ago.

We implemented a solution for it, just cannot recall what it was...
 

Mike

XenForo developer
Staff member
#3
I think it is a xenforo's bug and it should be fixed.
The thing is, you're adding arbitrary JavaScript into a template. We can't really account for that. JS like this can do things that violate assumptions or outright break the page if they attempt to write to the document in certain ways. This is why a lot of systems actually have explicit APIs that are generally to be used when it comes to ajax requests.

I you post any errors in the JS console we might be able to account for things a bit, but in general, we can't necessarily be defensive against arbitrary template changes.
 

maxicep

Active member
#4
You should support that i think @Mike

Why we can't use some ads codes on xenforo forum software? If you are not interesting with that problem due personel template edits then you must add ad placement feature on your software.

I'm sorry sometimes really because we switch from vbulletin.

Thank you.
 

Mike

XenForo developer
Staff member
#5
If you are not interesting with that problem due personel template edits then you must add ad placement feature on your software.
There is an ad placement feature via the templates, but it's still arbitrary code going into the page that we don't necessarily have control over.

But to emphasize, without some further details about the errors logged in the console, it would be very difficult for us to make any recommendations whatsoever.
 

Mr Lucky

Well-known member
#6
Surely arbitrary code is one thing, but Google Adsense is so endemic to web sites that it is something that should be accommodated for, notwithstanding its arbitrariness.
 

Optic

Well-known member
#7
Has anyone found a workaround for this?

I am also using responsive AdSense codes (which are only asynchronous) and as a result it is breaking many of the XF inline features:
  • Quick Reply not inserting post automatically without manual refresh (as mentioned above)
  • Quick Edit overlay not updating post automatically without manual refresh
  • Revealing soft deleted posts not working
Or will this be addressed in XF2?
 

Optic

Well-known member
#8
I have reverted back to using the synchronous codes (with responsive approach to load the appropriate ad units) for pages that contain the quick reply editor.

To be fair it seems the async code also breaks other web editors that also dynamically refresh page content.

The async responsive unit was so convenient that otherwise "just worked" :(