jrief / django-formset

The missing widgets and form manipulation library for Django
https://django-formset.fly.dev/
MIT License
326 stars 35 forks source link

Handle cross-origin errors when parsing styles #44

Closed franga2000 closed 1 year ago

franga2000 commented 1 year ago

When using external stylesheets, the site can't access their contents due to cross-origin request restriction, which completely breaks the form.

This PR handles two cases:

  1. A top-level stylesheet (<link rel="stylesheet" href="...">) is loaded from a different origin (like a CDN):
    in this case, a warning is printed instructing the developer to add crossorigin="anonymous" to the <link>, which fixes the issue console log

  2. An accessible (same-origin or crossorigin="anyonymous") stylesheet loads an external stylesheet via @import:
    in this case, no workaround exists (that I know of), but a warning is still printed to let the developer know console log

(Fixes #39)

jrief commented 1 year ago

interesting use case. I generally advise against including CSS and JS from a CDN.

jrief commented 1 year ago

interesting use case. I generally advise against including CSS and JS from a CDN.