Make go()
open non-local links in a new tab/window
Committed d61c30
--- a/web.ts/index.ts
+++ b/web.ts/index.ts
}
export function go(url) {
- if (url.startsWith("/http")) {
- window.open(url.substring(1), "_blank")
+ if ((url.startsWith("http://") || url.startsWith("https://")) &&
+ !url.startsWith(window.location.origin)) {
+ window.open(url, "_blank")
} else {
history.replaceState({scroll: window.pageYOffset}, "title", window.location.href)
updateArticle(url, 0)