Select to view content in your preferred language

Is it possible to undefine/unload the current version of ESRi in order to load another version of ESRi in same browser page?

746
2
06-05-2024 03:04 PM
JonathanTiu
Occasional Contributor

The situation we are in is we have an application in a browser window that downloads parts of the ESRI 4.29 JS arcgis API that we need  (using esri-loader).

Due to our requirements, our application in the same browser window would also need to be able to also load our maps with ESRI 3. However we do NOT need to support esri 3 AND esri 4 at the same time in the same window. We only need to use one or the other but not at the same time. We cannot open another browser window etc. - we'd be using the same existing one.

But what i'm seeing is when i try to load ESRI 3 (ie. https://js.arcgis.com/3.42/init.js), it blows up with errors like things already defined or i see in the network tab, it's trying to access esri 3 objects under the 4.29/ url so obviously there is state already initialized by 4.29 somewhere that is messing up loading of esri 3.x

 

My first hunch is there a way to unload or undefine eri 4  such that one can then load ESRI 3?  And vice versa?

Like are there objects in the global namespace that esri 3 or 4 initialized that i can null out, etc.  If it has to come to that, i'm willing to do it.  This is a scenario our application needs to be able to support.

 

JonathanTiu_0-1717625494771.png

 

0 Kudos
2 Replies
KevinMorrow
Emerging Contributor

Hi Jonathan, I have similar issue with old app on 3.x and newer version rewritten in 4.x. After I switch apps it does not load but a simple reload of the page and the new js API is loaded and things work. Typically we would not be using both apps but do it for testing feature compatibility between our two apps. We hadn't looked at a way to unload the current API since the simple reload worked.

0 Kudos
JonathanTiu
Occasional Contributor

Thanks. Yes in our case our users may not reload the page. That's the problem they can navigate through our system in such a way that they can load a document that uses esri 3 and then load another document that  we use esri 4.  

i've been poking around the window namespace and see various things like $arcgis and dojoConfig defined. i am trying to blow those away to see what will happen.???

0 Kudos