source: allow external website inclusion of json
authorMischa POSLAWSKY <perl@shiar.org>
Mon, 17 Aug 2020 16:40:04 +0000 (18:40 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Tue, 20 Oct 2020 20:49:11 +0000 (22:49 +0200)
Header to permit data being used in modern browsers.

source.plp

index 5d445e5658f530539b79108238e0266b6a286a62..f49c8edeea7788e3e5974e857d25d87af5ca74f6 100644 (file)
@@ -13,6 +13,7 @@ if ($source =~ s{(?<=\Q.inc.pl\E)/jsonp?$}{} and -r $source) {
                $converter->indent->space_after->canonical;
 
                $header{content_type} = 'application/json';
+               $header{'Access-Control-Allow-Origin'} = '*';
                $header{content_type} = 'text/plain' if exists $get{debug};
                print $_, '(' for $get{callback} // ();
                print $converter->encode($data);