How to enable CORS in Codepen to get Wikipedia viewer working?

Hello everyone,

For my wikipedia viewer to work, I need cross-origin resource sharing enabled. In chrome, I have a plugin for this, but works normally in safari and firefox. It’s just that when I post to codepen CORS is not enabled. Is there any way to enable CORS on codepen? I’d appreciate if anyone could chime in.

Codepen link:

add &callback=? to the end of your url :slight_smile:


hi fellow…

please i really need your help, am very new to this platform and i kind of dont know how to operate in here since a major in javascript.

Hi, try putting this at the bottom of your JS code.

jQuery.ajaxPrefilter(function(options) { if (options.crossDomain && { options.url = '' + options.url; } });

It works for me on the weather app, but I don’t need it now as I changed API.

I got it off stack overflow.

It works by directing your non https request via a proxy.

Hope that does it for you.


1 Like

@Cinders-P thanks a lot for the &callback=? trick, it helped me, kind regards!