Skip to content

Widget Loading

Learn how to properly load the CryptumPay Widget in your application.

Content Security Policy (CSP)

If you use CSP, add these directives:

http
Content-Security-Policy: 
  script-src 'self' https://cdn.cryptumpay.com;
  connect-src 'self' https://wapi.cryptumpay.com;
  frame-src https://pay.cryptumpay.com;

Performance Best Practices

1. Use Async Loading

Always use the async attribute to avoid blocking page rendering.

2. Preconnect to CDN

Speed up widget loading by preconnecting to the CDN:

html
<link rel="preconnect" href="https://cdn.cryptumpay.com">
<link rel="dns-prefetch" href="https://cdn.cryptumpay.com">

Troubleshooting

Widget Not Loading

Check browser console for errors:

  • Network errors (CDN blocked, firewall)
  • CSP violations
  • JavaScript errors

Verify script tag:

  • Correct src URL
  • Valid integrity hash
  • Proper async attribute

Ready Event Not Firing

Common causes:

  • Script tag placed after your event listener code
  • Ad blockers blocking CDN requests
  • Network timeouts

Solution: Always place the script tag in <head> and event listeners after.

See Also

Released under the MIT License.