A cross-origin url cannot be redirected to if "externalLinkTarget" is set to "_self" and "routerMode" is set to "history"
See original GitHub issueBug Report
Steps to reproduce
Set the options firstly:
window['$docsify'] = {
routerMode: 'history',
externalLinkTarget: '_self'
}
Then write a link whose url is from another domain:
Example: [example.com](https://example.com/)
What is current behaviour
If our domain were docsify.now.sh
, it would do nothing and pop an error on the debug console:
Uncaught DOMException: Failed to execute 'pushState' on 'History': A history state object with URL 'https://example.com/' cannot be created in a document with origin 'https://docsify.now.sh' and URL 'https://docsify.now.sh/'.
at https://unpkg.com/docsify@4.10.2/lib/docsify.min.js:1:61459
The corresponding source code is here.
What is the expected behaviour
Redirect to https://example.com/
normally.
Other relevant information
-
Bug does still occur when all/other plugins are disabled?
-
Your OS:
Linux ZZZ-PC-4 5.4.0-4-amd64 #1 SMP Debian 5.4.19-1 (2020-02-13) x86_64 GNU/Linux
-
Node.js version:
v12.14.0
-
npm/yarn version:
6.13.4
-
Browser version:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.122 Safari/537.36
-
Docsify version:
4.10.2
-
Docsify plugins:
None
Issue Analytics
- State:
- Created 4 years ago
- Comments:12 (9 by maintainers)
Top Results From Across the Web
How to follow redirections on a cross origin request with no ...
Sometimes, we just need the redirection to occur even though we cannot access the response. This article shows how you make the browser...
Read more >Redirections in HTTP - MDN Web Docs - Mozilla
URL redirection, also known as URL forwarding, is a technique to give more than one URL address to a page, a form, or...
Read more >Cross-origin redirection denied by Cross-Origin Resource ...
domain-c is the domain where the request is finally redirected to. First of all, I think, you want to make a workaround. As...
Read more >The Ultimate Guide to Redirects: URL Redirections Explained
Website owners often set up redirects for pages that are broken, contain duplicated content, or were moved to new URLs.
Read more >Navigations - XS-Leaks Wiki
Check the value of history.length, which is accessible through any ... Set the destination URL to test for the download attempt var url...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@BeamerIsHere thx for ur report! Could you please open a new issue to let us check it in process ? somehow, I can’t open ur sites to check the configurations, so I guess u need provide ur repo also in case of the site is unavailable. or u can make it in Sandbox.
@Koooooo-7 @anikethsaha I’ve got the same issue with external links.
I have a _coverpage file and added some external links to it and also enabled history routing mode. Getting the same error. Since I have the links in the _coverpage file( not in MD), I’m confused by the solutions above.
I’ll add my coverpage and index.html file here.
Thanks in advance!
Getting this error
“Uncaught DOMException: Failed to execute ‘pushState’ on ‘History’: A history state object with URL ‘https://tfs.insidenci.com/Energy-=contents’ cannot be created in a document with origin ‘http://127.0.0.1:5500’ and URL ‘http://127.0.0.1:5500/docs-home’.”
Index page
<!DOCTYPE html> <html> <head> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta name="viewport" content="width=device-width,initial-scale=1"> <meta charset="UTF-8"> <link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify/themes/vue.css"> </head> <body> <div id="app"></div> </body> </html>Coverpage
Data Tools Landing Page
<div class="center" style="text-align: justify; max-width:600px"> Welcome to the Data Tools Landing Page for Advanced Solutions. Here you will find access to and documentation for (almost) all the data management, analytics, modeling and visualization tools supported by Advanced Solutions. Please reach out on Teams if you have any questions or concerns. </div>Analytics
Login
Docs
Warehousing
Login
Docs
Visualization
Dev
|
Test|
UAT|
ProdDocs
Login
Docs
Collaboration
Login
Docs
Login
Docs
Go to
TechDocs