runisland / meteor-ionic4

Meteor Atmosphere package that automatically imports Ionic4 Web Components into your Client templates
MIT License
14 stars 6 forks source link

Dev server demo not working on mobile #5

Closed cramrov closed 6 years ago

cramrov commented 6 years ago

Hi,

I'm running the Blaze demo on localhost, and when I open Safari or Chrome on my iOS or Android device pointing to the localhost IP of my LAN, I see a blank page. The demo runs OK on desktop.

Whats wrong?

Thank you! /marc

ghybs commented 6 years ago

Hi,

Does the online demo work on your iOS and/or Android devices? https://runisland.github.io/meteor-ionic4/blaze-flowrouter/ (I have not updated it in a while, but it should already give some idea)

Does a normal Meteor+Blaze (without Ionic4) project work fine when you access it from your mobile devices?

ghybs commented 6 years ago

FYI, I updated the online demos to version 4.0.0-beta.3

cramrov commented 6 years ago

Hi @ghybs, The online demo works well on mobile, and any other Meteor+Blaze (without ionic4) works well either. I've followed the insructions here in order to reproduce the demo locally: https://github.com/runisland/meteor-ionic4/tree/master/examples/blaze-flowrouter

Finally, I've updated the ionic4 package and still not working.

Thank you for helping me.

Regards, /marc

ghybs commented 6 years ago

Hi,

Ok I see what is happening.

Ionic4 assets are retrieved using Meteor.absoluteUrl, so that they are not affected by subpaths or prefix.

However, during development, Meteor sets ROOT_URL by default to http://localhost:3000. But when you try accessing your development server from another machine (typically from a mobile device), you connect to that localhost server typing the IP of your dev machine (e.g. http://192.168.1.10:3000), instead of http://localhost:3000. Therefore Meteor.absoluteUrl now gives an URL that cannot be accessed by the remote machine. So Ionic4 assets cannot be loaded in the device browser, and the app screen remains blank.

I think there are 2 good news then:

cramrov commented 6 years ago

@ghybs , thank you for the discovery, the workaround works fine, I close the issue.