Salesforce is releasing Lightning Web Security(LWS) for Aura as GA in Summer 23, and in the LWS Limitation Article says that window.location cannot be used because LWS set that to null. My questions are:

  1. Does Salesforce intend to fix this limitation? If they do intend to fix this issue, we don’t intend to fix our code but suggest for our customers to disable the LWS for now. If they don’t, them we intend to research on how we can get the same information in different way.
  2. Does Salesforce has another library that we can get such data like hostname, parameter, etc..?

We do use the location to get some information of the page such as:

  1. location.search: to get list of parameters
  2. location.href: get current address
  3. location.hostname: get the hostname

It seems that even jQuery uses location as well, which for us will be a big task to change.

Source: LWS Limitations: https://developer.salesforce.com/docs/component-library/documentation/en/lwc/lwc.security_lwsec_aura_limitations

Release notes: https://help.salesforce.com/s/articleView?id=release-notes.rn_lc_lws.htm&release=244&type=5

Thank you in advanced!

  • 2
    1. We don't know. 2. There's no universal fix, except perhaps porting to LWC. But to be sure, you should raise a case with Dev Support, see if they can offer any insight.
    – sfdcfox
    May 11, 2023 at 15:22
  • @sfdcfox thank you for answering. Can I assume when you said As "we" you mean the community in Salesforce StackExchange? May 15, 2023 at 13:47
  • 1
    We, as in the general public. Anything that hasn't been announced cannot be assumed, and even then, if it's under Safe Harbor, there's no guarantee. It's not until it's released that we know anything for sure.
    – sfdcfox
    May 15, 2023 at 14:15
  • Thanks, I posted the same question in the Partner Community for ISVs I will see what Salesforce has to say. Thank you again for your input. May 15, 2023 at 15:48
  • It seems that they will update the Limitation Article and it seems that they are working on support the location. If someone has access to the partner community, this is the link: partners.salesforce.com/0D54V00006xog5n May 15, 2023 at 20:00


You must log in to answer this question.

Browse other questions tagged .