Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

next 9.5.2 Router not working on ionic webview #16456

Closed
Cow258 opened this issue Aug 21, 2020 · 6 comments · Fixed by #16650
Closed

next 9.5.2 Router not working on ionic webview #16456

Cow258 opened this issue Aug 21, 2020 · 6 comments · Fixed by #16650
Labels
good first issue Easy to fix issues, good for newcomers
Milestone

Comments

@Cow258
Copy link
Contributor

Cow258 commented Aug 21, 2020

Bug report

Describe the bug

When using v9.5.2 on ionic webview,
next/router not working at all,

  • Router.push('/login')
  • <Link href="/login">

No error message
No response to click

The ionic webview is using ionic://localhost/,
maybe v9.5.2 unable to working on ionic://localhost/.

To Reproduce

I hope the description enough to explain where are the problem,
It take time to create a demo repo,
I will create it if must.

Expected behavior

  1. Universal links
    Using Router.push('/login') to redirect,
    Scan url QR code, auto open the app, then nothing happen.
    It should redirect.

  2. Link tag
    Click on the <Link>, then nothing happen.
    It should redirect.

Screenshots

image

System information

  • OS: iOS 13.6
  • Browser Safari Ionic Webview 5.0
  • Version of Next.js: 9.5.2
  • Version of Node.js: 12.16.3
@Cow258 Cow258 changed the title v9.5.2 Link not working on ionic webview v9.5.2 Router not working on ionic webview Aug 22, 2020
@Cow258 Cow258 changed the title v9.5.2 Router not working on ionic webview next 9.5.2 Router not working on ionic webview Aug 22, 2020
@timneutkens timneutkens added the good first issue Easy to fix issues, good for newcomers label Aug 22, 2020
@timneutkens
Copy link
Member

Feel free to investigate and fix / post back here with the investigation.

@Janpot
Copy link
Contributor

Janpot commented Aug 22, 2020

probably because of

(protocol !== 'http:' && protocol !== 'https:')

you don't see any warnings in development?

@Cow258
Copy link
Contributor Author

Cow258 commented Aug 23, 2020

probably because of

(protocol !== 'http:' && protocol !== 'https:')

you don't see any warnings in development?

I think you found the root of the problem. 👍🏻

Unfortunately,
Here are no way to run development mode on mobile side,
Required production static export for using ionic://localhost/ and run nextjs inside webview.

Maybe some way to export development static content,
then I can able to test it on mobile.

Also,
Development mode required using http://192.168.0.200 with same Wifi network to connect to dev server for remote debug on mobile side.

Also,
Device log and console log didn't show any error.

Thanks

@paulobarcelos
Copy link

paulobarcelos commented Aug 25, 2020

Happy to see that this issue was reported, I found the same problem (and narrowed it down parse-relative-url.ts).

On my case this was completely broken our app (NWJS), since that is served with the chrome-extension:// protocol.

@timneutkens would it be possible to extend this function (parseRelativeUrl), with custom protocols? Or at least extend it with protocols like ionic:// and chrome-extension://?

I don't really know how to get around this - but the issue is serious, currently we can't ship any updates to our production app 👎

@Janpot
Copy link
Contributor

Janpot commented Aug 25, 2020

The right solution is probably to also compare the protocol with window.location.protocol in parseRelativeUrl. i.e.

(protocol !== 'http:' && protocol !== 'https:' && protocol !== DUMMY_BASE.protocol)

This should detect a url with the same scheme as the page it is rendered on as relative. It makes sense because the fact that the browser you are using is rendering the app as a webpage implies that the browser is capable of handling the custom scheme.

Not quite sure how we can test this behavior though since the browsers that the next.js tests run on only handle the http and https scheme as webpages

Cow258 added a commit to Cow258/next.js that referenced this issue Aug 28, 2020
Added support for protocols other than http and https

Fixes vercel#16456
Cow258 added a commit to Cow258/next.js that referenced this issue Aug 30, 2020
Added support for protocols other than http and https

Fixes vercel#16456
Cow258 added a commit to Cow258/next.js that referenced this issue Aug 30, 2020
- Added support for protocols other than http and https
- Added test case

Fixes vercel#16456, vercel#16595
@Timer Timer added this to the backlog milestone Sep 7, 2020
Cow258 added a commit to Cow258/next.js that referenced this issue Sep 11, 2020
- Added support for protocols other than http and https
- Added unit test
- Added integration test

Fixes vercel#16456
Fixes vercel#16595
Cow258 added a commit to Cow258/next.js that referenced this issue Sep 28, 2020
- Added support for protocols other than http and https
- Added unit test
- Added integration test

Fixes vercel#16456
Fixes vercel#16595
Cow258 added a commit to Cow258/next.js that referenced this issue Oct 26, 2020
- Added support for protocols other than http and https
- Added unit test
- Added integration test

Fixes vercel#16456
Fixes vercel#16595
@Timer Timer modified the milestones: backlog, iteration 12 Nov 3, 2020
@balazsorban44
Copy link
Member

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@vercel vercel locked as resolved and limited conversation to collaborators Jan 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
good first issue Easy to fix issues, good for newcomers
Projects
None yet
7 participants
@paulobarcelos @Timer @Janpot @timneutkens @Cow258 @balazsorban44 and others