docsifyjs / docsify

🃏 A magical documentation site generator.
https://docsify.js.org
MIT License
27.17k stars 5.66k forks source link

external links don't work in history router mode #1803

Closed pagyew closed 1 year ago

pagyew commented 2 years ago

Bug Report

Steps to reproduce

  1. Set routerMode to history.
  2. Create mailto link with <my@mail.com>, or any external link.
  3. Click on rendered link.

What is current behaviour

Crashes with error:

SecurityError
Failed to execute 'replaceState' on 'History': A history state object with URL 'mailto:my@email.com' cannot be created in a document with origin 'https://kc32ry.csb.app' and URL 'https://kc32ry.csb.app/'.

What is the expected behaviour

Native behaviour

Other relevant information

Please create a reproducible sandbox

Edit immutable-sunset-kc32ry

Live example: https://docs.lume.io/

Mention the docsify version in which this bug was not present (if any)

trusktr commented 1 year ago

Indeed, non-docsify links (external links) are currently not working in history router mode. We need to fix this and add tests.

live example: https://docs.lume.io/

trusktr commented 1 year ago

I found the issue. It happens when externalLinkTarget: '_self' is specified. Fix WIP