0

I was Usign a Cross-Domain Manifest.Json Here My Json File (located at http://123myblog14.co.nf/manifest.json):

{
  "short_name": "Universal Manual",
  "name": "Universal Manual",
  "theme_color": "#4A90E2",
  "background_color": "#F7F8F9",
  "display": "standalone",
  "icons": [
    {
      "src": "https://1.bp.blogspot.com/-jNpzwSZoHI4/Wn8trSeVxOI/AAAAAAAAAao/SJEDZypr0aw22ekaf54gP_uBc0UMIkevACLcBGAs/s320/48x48.png",
      "type": "image/png",
      "sizes": "48x48"
    },
    {
      "src": "https://1.bp.blogspot.com/-EvJoMC9Ofio/Wn8trZJCPeI/AAAAAAAAAak/aVIfXSwRJp0ccKYpXg52ZKs6tNB2SpNDwCLcBGAs/s320/96x96.png",
      "type": "image/png",
      "sizes": "96x96"
    },
    {
      "src": "https://3.bp.blogspot.com/-Al0F7R0hpjo/Wn8trVIOoEI/AAAAAAAAAag/5ESG8a3skgMGEhS5zVZ-5FKPHA3bWTBxQCLcBGAs/s320/144x144.png",
      "type": "image/png",
      "sizes": "144x144"
    },
    {
      "src": "https://1.bp.blogspot.com/-myt190wt15M/WnnH7The49I/AAAAAAAAAZY/86YIMqtB7U8cZ7wHIhFx-pgSHZVg0V5YQCPcBGAYYCw/s320/192x192.png",
      "type": "image/png",
      "sizes": "192x192"
    }
  ],
  "start_url": "/?utm_source=launcher"
}

But Crome Shows Below Error in warning.

property "start_url" ignored,should be same origin as document

I'm usign it on My website with Https but the website where it is hosted isn't https. Is this is Reason?

Álvaro González
  • 142,137
  • 41
  • 261
  • 360
Ajay Malik
  • 325
  • 4
  • 17

1 Answers1

0

chrome sets the cross-origin header to the host name if a cross-origin header is not present, to solve this you need to send Access-Control-Allow-Origin with the value * from your website ( 123myblog14 )

you can either send the header with php like this :

 header('Access-Control-Allow-Origin','*');

or via .htaccess

<IfModule mod_headers.c>
    Header set Access-Control-Allow-Origin "*"
</IfModule>

update

you can create a php file next to manifest.json like this

manifest.php

<?php
 header('Access-Control-Allow-Origin: "*"');
 header('Content-Type: application/json');
 echo file_get_contents('manifest.json');
?>

and you can access manifest.json from manifest.php

azjezz
  • 3,827
  • 1
  • 14
  • 35
  • did this work https://github.com/vitvad/Access-Control-Allow-Origin/blob/master/manifest.json ? – Ajay Malik Feb 10 '18 at 18:04
  • i really don't know, your question is tagged with `php`. so i answer with the php , and the second one should work too i you are using apache – azjezz Feb 10 '18 at 18:06
  • It actually didn't even detecting manifest.json now after adding above code in my .htaccess file. I think this is due to https. – Ajay Malik Feb 10 '18 at 18:09
  • i found the same question asked on github : https://github.com/cargomedia/CM/issues/1712 . and i think the answer is to you the same hostname to serve manifest file ( same domain ) – azjezz Feb 10 '18 at 18:13
  • `` I use it as shown in this code but this doesn't work – Ajay Malik Feb 10 '18 at 18:15
  • here an website on which i testing this code but crome didn't even detecting manifest.php https://www.universalmanual.com/ – Ajay Malik Feb 10 '18 at 18:22
  • hmm, weird, seems like a chrome issue, it works fine on firefox – azjezz Feb 10 '18 at 18:25