Cross-Origin warning for wp_enqueue_script for jquery-ui

The method for including scripts in my wordpress plugin is in another post: How to load jquery dialog in wordpress using wp_enqueue_script?

I think this works fine for me, but I get a strange error in the Firefox dev tools console when I load my page after posting stuff (js and css) in jquery-ui. Here is my code:

wp_register_script( 'myplugin-jquery-ui', plugins_url("myplugin/js/jquery-ui.min.js" ) );
wp_enqueue_script( 'myplugin-jquery-ui');

      

But when I load the page in Firefox the console says:

Cross-origin request blocked: Same origin policy disallows reading remote resource at http://fonts.gstatic.com/s/opensans/v10/u-WUoqrET9fUeobQW7jkRT8E0i7KZn-EPnyo3HZu7kw.woff . This can be fixed by moving the resource to the same domain or enabling CORS.

I can't find the "fonts.gstatic.com" referenced by ANYWHERE in ANY of my files, and most notably the jquery-ui.min.js file. Can you please help me understand: a) why / how I am getting this error, and b) if this is something I should just ignore?

And if I only need it for the dialog plugin, should I do it differently?

+3


source to share


1 answer


This is a Google bug. It doesn't serve the header correctly sometimes for reasons that only they know. The bulletproof way to prevent this shame is to get the font files and serve them yourself.



You can check the headers received when serving Woff and you will see how they don't send the header when the browser doesn't load the font. If you can't believe your browser, check out a network analyzer tool like Wireshark.

0


source







All Articles