rowanwins / leaflet-easyPrint

A leaflet plugin which adds an icon to print the map - Demo @ http://rowanwins.github.io/leaflet-easyPrint/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Failed to read the 'cssRules' property from 'CSSStyleSheet'

MarioCarloni opened this issue · comments

We have developed a leaflet app including your leaflet-easyPrint module, instantiated like so:

L.easyPrint({ title: 'Print', position: 'topright', sizeModes: ['A4Portrait', 'A4Landscape'], }).addTo(map)

The printing functionality works, but we receive multiple cssRules errors from other packages in the console each time either portrait or landscape printing is selected, like so:
image

After some digging, we've discovered that this is from a CORS violation explained on StackOverflow and W3. The explanation suggests running a local development server would suffice, but the errors persist through both local and production servers.

What other information is necessary to discern whether the CORS violation is from all other packages from the pic above, or from your package? Why would it happen on-click of the print control?

UPDATE:

So importing all CSS into the project instead of using unpkg then using /* eslint-disable */ above all referenced error lines from the bundle should effectively hide the error.

Although, I'm still unsure as to why it would happen only on-click of the print control?

Hi @MarioCarloni

So basically when the print button is clicked the map is copied from the existing browser window to a new browser window so that it can be resized more effectively. I suspect it's something in this process that's causing things to go a bit haywire.

Unfortunately CORs is a major thorn in the side of this library at the moment :(

Hey @rowanwins

We're all learning here, so no worries. Thanks for the response!

Hey @MarioCarloni,
Please, have you found any solution for this !?