I have a js library uploaded as a static resource that I am using in my VF page. This library has a "config" object which contains server info etc.

The problem is that I need to update the "config" object from my VF page as per my requirement, please let me know what are the ways that I can achieve this?

One way that I have tried is that, If I use another js file containing "config" object as a static resource in my VF page, it works fine.

But my goal is to update this "config" object from VF page dynamically.

  • 1
    As long as the config object is accessible through a global variable (e.g. something attached to window), you can access it dynamically via window.config or the like. Without seeing some sample code, it'd be hard to say much more than this.
    – sfdcfox
    Commented May 10, 2022 at 12:34
  • @sfdcfox yes with window.config it is accessible and I am able to update it as well. Earlier I was trying it to access with just config. Please post it as an answer so I may accept that. Thank you.
    – Badar
    Commented May 10, 2022 at 12:59

1 Answer 1


In JavaScript, each imported file is isolated by default. However, you can access any global variable, one attached to window, to work with data and methods from that file. In your case, you can use window.config to access the configuration from Visualforce.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .