lmendivil
lmendivil

Reputation: 157

PWA - Meteor 1.9 - How to Open on a specific route dynamically

My environment: meteor 1.9

I made PWA my meteor project. And when you add the app to your home screen, it opens on main route. For example: mymeteorpwa.com but I'd like to know how can it opens on a specific route, For example: mymeteorpwa.com/controller?appId=784512?type=arrow (however, it can be mymeteorpwa.com/controller?appId=784512?type=face I mean, the type could be dynamic)

Please, do you have any idea?

Thanks!

Upvotes: 1

Views: 212

Answers (2)

Paul Paulincai
Paul Paulincai

Reputation: 644

in your PWA manifest you have:

"start_url": "/?homescreen=1", // or any other url (route) you prefer

Everything else is not PWA related. You need a router and manage your logic and dynamic routing at the router leve.

Upvotes: 1

thatsmycode
thatsmycode

Reputation: 21

The examples below are for iron:router.

meteor add iron:router

If you receive an error about jquery then...

meteor add jquery@=1.11.11
meteor npm remove jquery
meteor add iron:router

Create a routes.js file in your client folder.

Router.route('/', function () {
  this.redirect('/controller/784512/arrow');
});
Router.route('/:page/:appId/:type', function () {
  // do something with url parameters
  // this.params.page == 'controller'
  // this.params.appId == '784512'
  // this.params.type == 'arrow'
});

Upvotes: 1

Related Questions