question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Router not working with two BrowserWindows

See original GitHub issue

Hi, I’m trying to create an app with two BrowserWindows using the same Vue App with vue-router, but the router aren’t working. I’m always receiving error ‘Cannot GET /’ for the second route.

main\index.js

var mainURL = `http://localhost:9080/`
var secondURL = `http://localhost:9080/page2`

function createWindow () {
  mainWindow = new BrowserWindow({
    height: 600,
    width: 800
  })
  mainWindow.loadURL(mainURL)
  mainWindow.on('closed', () => {
    mainWindow = null
  })

  secondWindow = new BrowserWindow({
    height: 600,
    width: 800
  })
  secondWindow.loadURL(secondURL)
  secondWindow.on('closed', () => {
    secondWindow = null
  })
}

app.on('ready', createWindow)

routes.js

export default [
  {
    path: '/',
    name: 'landing-page',
    component: require('components/LandingPageView')
  },
  {
    path: '/page2',
    name: 'landing-page2',
    component: require('components/LandingPageView2')
  },
  {
    path: '*',
    redirect: '/'
  }
]

Testing code: https://github.com/melquic/vue-two-windows.git

Error print screen: vue-two-windows-error

Thank you for help! Best.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

11reactions
SimulatedGREGcommented, May 5, 2017

@melquic

I would highly avoid using the history mode as it won’t work in a final production app. By using the default hash mode and changing the url in the second window to http://localhost:9080/#/page2 things should work fine.

8reactions
melquiccommented, May 5, 2017

@SimulatedGREG Thank you a lot! It’s working now… By the way, how should I call the second route when I build production? file://${__dirname}/index.html#page2 ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

CANNOT ACCESS ROUTER ON MULTIPLE BROWSERS
Hello, I got a new computer (W10) and I cannot access my router on Chrome or Edge (routerlogin.net). A few months ago I...
Read more >
Fix Internet Connected But Not Working Windows 10 - YouTube
Having network problems ? No Internet Access? Can't connect to the internet via a browser ? Computer says your connected to Internet but...
Read more >
Internet Connection Sharing Not Working on Windows 10 ...
Internet Connection Sharing Not Working on Windows 10 [Tutorial]Many users reported receiving the error message Internet connection sharing ...
Read more >
How To Fix WiFi Connected But No Internet Access ... - YouTube
Check if is a problem with the router 3. Run the Windows network troubleshooting tool 4. Reset your network adapter 5. Reset Windows...
Read more >
How to Fix Some Websites Not Loading/Opening in ... - YouTube
In this video I will show guys how to fix some websites are not loading or opening in your Browser. DNS: 8.8.8.84.2.2.2CMD Command:ipconfig ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found