-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Swap cross-origin iframe to cross-origin request
I've picked the creative rotation example at random to try out the createWorklet function here. Unlike the previous commit where you can do a straight swap between addModule and createWorklet, in this commit I've removed the iframe completely. As we're relying on the data being managed by the script-origin I've also had to move the seedStorage function into the worklet so it is written into the storage for the content producer instead of the publisher. I've also set a new click handler for the demo controls, this also loads the worklet to ensure we write to Shared Storage with the script- origin. Whenever we request a worklet from a different origin we need to set the headers to allow cors and enable cross origin worklets. As I've removed the iframe, I've moved the controls of the demo into the invoking page directly (using hbs partials). For the sake of the demo I've added the global getContentProducerUrl function to make it easier to check the domain of the content producer within the JS files for getting the worklet and the ads. Also, as the demo is no longer being styled within the iframe I've copied the css styles to the publisher pages.
- Loading branch information
Showing
11 changed files
with
185 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<div class="demo__controls-section"> | ||
<fencedframe id="ad-slot" mode="opaque-ads"></fencedframe> | ||
<div class="demo__controls"> | ||
<h5>Demo control</h5> | ||
<div class="demo__buttons-container"> | ||
<button | ||
class="mdl-button mdl-js-button mdl-button--raised demo__button" | ||
onclick="setRotationMode('sequential')" | ||
> | ||
Set rotation mode to <br />"Sequential" | ||
</button> | ||
<button | ||
class="mdl-button mdl-js-button mdl-button--raised demo__button" | ||
onclick="setRotationMode('even-distribution')" | ||
> | ||
Set rotation mode to <br />"Even distribution"<br />(~33% / ~33% / ~33%) | ||
</button> | ||
<button | ||
class="mdl-button mdl-js-button mdl-button--raised demo__button" | ||
onclick="setRotationMode('weighted-distribution')" | ||
> | ||
Set rotation mode to <br />"Weighted distribution"<br />(70% / 20% / 10%) | ||
</button> | ||
</div> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 0 additions & 69 deletions
69
sites/content-producer/url-selection/creative-rotation.html
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters