DOM variable PORTAL_URL is now base_url in Plone6

While updating a theme to Plone6, I noticed that a piece of js that performs cosmetic fixes stopped working. This is because it was looking for PORTAL_URL in the DOM of the page, and this is now gone in Plone6... Lucklily, the value is still available, but now as base_url

I got curious and started searching as to what caused this change and why, but can"t seem to find anything more recent than the removal of plone_javascript_variables in 2015 and some GitHub chatter from 2017.

Where is this documented?

The standard way is to get it from the page with:

$("body").attr("data-portal-url");

A Page inside a Folder — English here I can't find base_url, maybe it is available in some context?

1 Like

I would expect base URL to be something different from the portal URL.

Thank you both!

I found PORTAL_URL here:

I would too.

Am going to avoid the issue completely and use the data attribute from now on...

1 Like