This example features two wrapping mboxCreate()'s:Support for mboxCreate() is included in at.js to make it easier to transition from mbox.js to at.js. You are encouraged to migrate your implementation to use the global mbox, or if you need wrapping mboxes use adobe.target.getOffer() + adobe.target.applyOffer() with the selector option or the Angular directive approach.
- classicMbox0 which is not serving an offer
- classicMbox1 which does serve an offer
-
Details
mboxCreate() is supported by at.js. All existing mboxCreate()'s on your site should continue to function! A few things to keep in mind:
- mboxCreate() now uses the "json" endpoint instead of the "standard" endpoint and fires asynchronously. Because of this:
- Debugging is a little different.
- Avoid offer code requiring synchronous, blocking calls. (e.g. offers that set javascript variables that are used by site code or other mboxes that come later on the page)
- Be sure to have a <div class="mboxDefault"></div> before invoking mboxCreate(), as at.js will not add one for you.
- Empty, top-of-page mboxCreate()'s are not recommended as a global mbox. The auto-created global mbox in at.js is a better option as it fires from the <head> and can return content earlier.
Example: <div class="mboxDefault"> Default Content </div> <script> mboxCreate('homePageHero'); </script>
- mboxCreate() now uses the "json" endpoint instead of the "standard" endpoint and fires asynchronously. Because of this:
mboxCreate (no content):
Default content.
mboxCreate:
Default content.