Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sample: fix prebid js loading bug on sample html page #3792

Merged
merged 1 commit into from
Oct 22, 2024

Conversation

And1sS
Copy link
Member

@And1sS And1sS commented Jul 3, 2024

There is a bug on sample html page:
image_2024-07-03_17-01-07

prebid.js:12 
Uncaught TypeError: Cannot read properties of null (reading 'appendChild')
    at U (prebid.js:12:9881)
    at $.processQueue (prebid.js:12:99684)
    at prebid.js:631:11

This is caused by appendChild() method call (inside pbjs) on a DOM element that doesn't exist yet .

This can be fixed by simply by deferring javascript scripts loading, and that is what i did in this pr.

@bsardo bsardo self-assigned this Aug 30, 2024
@bsardo
Copy link
Collaborator

bsardo commented Oct 18, 2024

@zhongshixi please give this a quick look when you have some time.

<script src="//cdn.jsdelivr.net/npm/prebid.js@latest/dist/not-for-prod/prebid.js"></script>
<script>
<script src="//cdn.jsdelivr.net/npm/prebid.js@latest/dist/not-for-prod/prebid.js" defer></script>
<script defer>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 for adding defer to ensure full html is parsed before running the script + ensure the order of execution of scripts

@bsardo bsardo merged commit 03a4abd into prebid:master Oct 22, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants