Unable to save a page after previewing it

While working on a client's website we found we were having issues saving and publishing pages after we previewed a page. It didn't matter what page or document type, we would just get a green cross when we clicked on the Save and Publish button. 

Below is a demo is the issue on this site:

 

You will notice when the page loads, I get the CivicUK Cookie policy displaying and this is the cause of the issue. 

Nik spotted the issue when we had devtools open. The UMB-XSRF-TOKEN was being deleted and this caused a number of issues to crop up when trying to then work in the backoffice of Umbraco. 

The only way we could get the page to save and publish was to refresh the browser, this then recreated the cookie until we did another preview! 

The fix

Open up the CIVICUK script that you need to add to your site to get the cookie policy working and simply add the following line:

necessaryCookies:['UMB*'],

So your script will look something like: 

 text : {
        thirdPartyTitle : 'Warning: Some cookies require your attention',
        thirdPartyDescription : 'Consent for some third party cookies can not be automatically revoked. Please follow the link below if you want to opt out of them.'
    },
     necessaryCookies:['UMB*'],
     optionalCookies: [
        {
            name : 'analytics',
            label: 'Analytical Cookies',
            description: 'Analytical cookies help us to improve our website by collecting and reporting information on its usage.',
            cookies: ['_ga', '_gid', '_gat', '__utma', '__utmt', '__utmb', '__utmc', '__utmz', '__utmv'],
            onAccept 


You can add all cookies that start with UMB to the whitelist and this then fixes the issue. 

I hope this helps you if you have a similar issue and use CIVICUK Cookie Control on your site. 

Published on: 13 October 2021