简体   繁体   中英

Laravel 5.2 with PWA

I am using laravel version 5.2 and I am trying to make it a PWA. For long hours of searching google and stackoverflow I can't find any suitable guides that will help me to make my laravel 5.2 app a PWA.. Can anyone help me? Please Ive been trying for a weeks already. I also tried creating my own service worker and manifest but the dynamic URL is the problem it doesn't render anything it just return to 127.0.0.1/dashboard . I am still on my localhost so PWA is supported by it.

Your problem can is on the route, you need create a specific route to your manifest.json and to your worker.js. This is an example to manifest.json:

Route::get('/manifest.json', 'YourController@Action')->name('manifest');

In controller action you need response a json.

return response()->json([
    'name' => 'name',
    'short_name' => 'short name',
    'start_url' => '/',
    'display' => 'standalone',
    'theme_color' => '#000000',
    'background_color' => '#000000'
]);

How reference you can see this repository https://github.com/silviolleite/laravel-pwa

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM