(NOT SURE, BUT THIS ISSUE MIGHT BE A SALESFORCE BUG OR AT LEAST AN INCONSISTENCY)
I have defined an Action of type "Custom Visualforce" like this
The button for this Action is "◈ Clone" (top right corner)
This opens up a Visualforce Page in a popup an I'm doing some stuff with Javascript. No Custom Apex Controller, only a standard controller used.
When I'm done, I just close the popup via cancel or via the X-bottom on top.
ALL WORKS FINE WITH NO ISSUES AT ALL
The problem starts after the popup is closed when I go on working in Lightning Experience. Then there is an unwanted entry in the browser history. Now when I just navigate back, I do not go to the place I would expect but the popup opens again and the Visualforce Action gets re-executed. This is absolutely not OK.
How can this be prevented? I need the Back-Button just to ignore the popup.
I've tried to kill the entry by JavaScript
https://developer.mozilla.org/en-US/docs/Web/API/Location/replace
Using
history.replaceState(null, "---", '/');
But I can't get rid of the history
UPDATE 1
This issue might not appear in Console Apps as Kris Goncalves stated. I did not verify it. If this is true, I think this is an Salesforce BUG in non-Console Apps
UPDATE 2
Untested idea of a workaround:
- Use Aura Component instead of VF Page as Action Type
- Write a wrapper Aura Component
- Use an IFRAME to host the VF-Page
- maybe the history is not polluted by the VF-Page
- OR the Aura Component can clean the history (which the VF-Page can not do itself)
- testing required