This is not possible, but not only because it is not supported in React.
Each time a browser detects a change to a new domain (subdomains too), a request to a DNS server is triggered (it may be cached but the request is always made), and the browser will then treat the content as coming from a different source.
This happens for very good reasons.
- If you were to suddenly switch domains without reloading, how would the browser know which site data to use?
- If you switched domains without realizing, you might accidentally enter private information into the wrong website!
I recommend you do not pursue this functionality within your website. Having two copies of the exact same code on different websites is not a good solution.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…