I can not navigate to other pages inside error page (errorPath)

I defined an error page in capacitor.config.ts file.

  server: {
    androidScheme: 'https',
    hostname: 'virasty',
    errorPath: 'error.html', // here

In the error.html page, I want to redirect the user to other pages, but it opens inside default browser, not in the app!

var matchVersion = navigator.userAgent.match(/chrome\/(\d+)/i)
if (matchVersion) {
  var version = +matchVersion[1]
  if (version >= 60) {
    location.href = 'https://virasty/index.html#/error'

How to redirect to other pages inside error page?