It appears that document.domain
is deprecated:
mdn web docs also say:
Deprecated: This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible;
However, I don't seem to find anywhere what can I use instead, to get the domain. I don't need to set, only get.
Other articles I read about the deprecation only mention about the alternative for the set problem, but they don't mention a solution/alternative for those who just want to get the domain.
https://developer.chrome.com/blog/immutable-document-domain/
https://portswigger.net/daily-swig/disavowed-chrome-plans-to-deprecate-document-domain-lays-the-groundwork-for-shift-in-browser-security
CodePudding user response:
I believe this is the best alternative I could find: location.hostname
Seems to contain only the domain and subdomain, without the port, similar to the result of document.domain
.