BranchMetrics / web-branch-deep-linking-attribution

The Branch Web SDK for deep linking and attribution. Once initialized, the Branch Web SDK allows you to create and share links with a banner (web only), over SMS, or your own methods by generating deep links. It also offers event tracking, access to referrals, and management of credits.
https://help.branch.io/developers-hub/docs/web-sdk-overview
MIT License
288 stars 101 forks source link

[JRNYS-2][INTENG-11986] Avoid document.write() #779

Closed jdee closed 3 years ago

jdee commented 3 years ago

This does not directly impact page rating by Google PageSpeed, but it eliminates diagnostic warnings about document.write(). The SDK has been just constructing a web page as text in memory and then shoving it into an iframe. This change modifies the DOM elements on the iframe directly instead, collapsing two utility functions into one.

This change is preliminary but has been deployed at https://jdee.github.io/pure-journeys-demo. This page no longer shows complaints about document.write().

There is a similar place in a code path called by branch.banner() that could be has been addressed in the same way but does not affect Google PageSpeed diagnostics. Unit tests ought to be provided for this. All existing unit tests still pass with these changes.

@BranchMetrics/core-team

jwangler-branch commented 3 years ago

👍

aaaronlopez commented 3 years ago

nice! lgtm 👍