emberjs / emberjs/ember.js

Router Service need a way to construct and recognize absolute URL

Open
#18,423 0 comments 3 reactions 0 assignees View on GitHub
Routing
Dominant language
TypeScript
Stars
22.6k
Forks
4.2k
Avg merge
3d 12h
Merged PRs (30d)
15

Description

Currently, there isn't a way to construct or recognize an "absolute" URL, i.e. `window.location.origin ( + routerService.rootURL ) + routerService.currentURL`.

This will become important when we want to intercept all link clicks on the page and have to decide whether to do a transition or a full navigation.

Things to consider: do we need to "virtualize" the "origin" too, or is it fine to always use `window.location.origin`? Probably need to virtualize it somewhat, because FastBoot and tests, but then we will probably need a way to set a fallback when we cannot infer it from the page, not too dissimilar with the same problem in Rails, where most of the time you can infer it from the protocol/host/port incoming HTTP request, but sometimes you cannot (in a non-http context, such as background jobs/workers, sending emails, etc).

This is only slightly related to #18422, in that if we are going to find a new name or change the API, maybe we can also take this into the account, either by making sure the names are consistent or maybe have a method that takes an option.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.