I´ve tested this on Google Chrome and Microsoft Edge. On Chrome, it rarely saves. On Edge, it always saves.
I´ve disabled all plugins, cleared cookies, allowed popups, etc., for Chrome, but none of this has solved the problem.
I think the issue is that the page is closed before it can be saved. When I remove this:
onclick="window.top.close()"
...the page always saves in Chrome too.
Is there a way to save and close the page without having this issue?
Here´s the vf page (the idea is that you click on a button, the vf page appears as a full-screen popup, you type the Campaign Name, Save, the popup closes, and a new Campaign Member is hopefully created, and visible in the related list after the Contact page is refreshed):
<apex:page standardController="CampaignMember">
<apex:form >
<apex:outputPanel id="CmPage">
<apex:pageMessages />
<apex:messages />
<apex:pageBlock mode="edit">
<apex:pageBlockSection columns="1">
<apex:inputfield value="{!campaignmember.campaignid}" label="Campaign Name" id="cmName"/>
<apex:inputfield value="{!campaignmember.Contactid}" label="Contact" id="CampaignMemberContactId" />
<script>
document.getElementById('{!$Component.CampaignMemberContactId}' + '_lkid').value = '{!$CurrentPage.parameters.ContactId}';
document.getElementById('{!$Component.CampaignMemberContactId}' + '_lkold').value = '{!$CurrentPage.parameters.ContactName}';
document.getElementById('{!$Component.CampaignMemberContactId}' + '_mod').value = 1;
document.getElementById('{!$Component.CampaignMemberContactId}').value = '{!$CurrentPage.parameters.ContactName}';
</script>
</apex:pageBlockSection>
<apex:pageBlockButtons >
<apex:commandButton value="Save" action="{!quicksave}" onclick="window.top.close()"/>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:outputPanel>
</apex:form>
</apex:page>