Remove rocket-loader.min.js
from Landing Pages
#77
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Fixes this reported issue, where a Landing Page setup to redirect, and embedded in WordPress, won't redirect to the thank you page URL.
The redirect not being honored appears to be caused by including
rocket-loader.min.js
.The Plugin fetches the landing page HTML, and then iterates through all scripts, checking if each src property is a fully qualified URL. If not (e.g. on landing pages, we find
<script src="/cdn-cgi/scripts/7d0fa10a/cloudflare-static/rocket-loader.min.js" data-cf-settings="5756229aeeb7b4c76b79f093-|49" defer></script>
), the Plugin will prepend the creator's URL (e.g.<script src="https://cheerful-architect-3237.ck.page/cdn-cgi/scripts/7d0fa10a/cloudflare-static/rocket-loader.min.js" data-cf-settings="c5d46ab73fb7b9b8aae27edf-|49" defer></script>
) to ensure it can load the script on a WordPress Page that outputs the landing page HTML (otherwise, the relative path to the script won't work, because the landing page isn't hosted by ConvertKit here).Removing this script allows the redirect to work, but I'm not understanding why, or whether this script can safely be removed by our WordPress Libraries / Plugins. If someone could let me know, we can then get this fixed.
Testing
rocket-loader.min.js
is removed. The main WordPress Plugin will need its own PR to confirm the same when using this version of the WordPress Libraries.Checklist