0

I working under a webpack solution and using EJS to render my pages and i want to display the hostname (my-domain.com) in the render by the EJS file and avoid to inject from a all_script.js like file

I've tried things like this and that's actually not worked :

<%= window.location.hostname %>

The expected result would be "my-domain.com"

PedroZorus
  • 661
  • 1
  • 6
  • 21

1 Answers1

0

I have finally found an alternative solution :

If we think about it: the only result we can get is a local hostname. So if we really need to get to future hostname, we are going topass it like a parameter by the webpack config.

https://stackoverflow.com/a/59127401/12084219

In the case in the previous link replace the JSON by a simple string containing the URL.

PedroZorus
  • 661
  • 1
  • 6
  • 21