function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
TobyKutlerTobyKutler 

redirect not working in firefox

public PageReference redirectToOpportunity(){
        String opportunityId = getId();
        system.debug('in go back to opportunity apex' + opportunityId); 
        return new PageReference('/lightning/r/Opportunity/'+opportunityId+'/view');
    }

The above code works perfectly fine in Chrome but does not redirect when using Firefox. I get the following logs when testing in firefox: 

User-added image 
Sai PraveenSai Praveen (Salesforce Developers) 
Hi,

It is difficult to view the logs in the screenshot. Can you share it as text so can check the logs.

Thanks,
 
TobyKutlerTobyKutler
in go back to opportunity MyApexClass:26:17

MouseEvent.mozPressure is deprecated. Use PointerEvent.pressure instead. 3_3_3.Finalorg.ajax4jsf.javascript.AjaxScript:123

Uncaught ReferenceError: InternalDialogs is not defined
    initAPI https://c.na103.visual.force.com/jslibrary/1637251310242/sfdc/VFRemote.js:125

    connect https://c.na103.visual.force.com/jslibrary/1637251310242/sfdc/VFRemote.js:93

    addProvider https://-c.na103.visual.force.com/jslibrary/1637251310242/sfdc/VFRemote.js:85

    add https://--c.na103.visual.force.com/jslibrary/1637251310242/sfdc/VFRemote.js:136

    <anonymous> https://--c.na103.visual.force.com/apex/MyApexClass?id=0063a00000m0iayAAA:8

VFRemote.js:125:387
    initAPI https://--c.na103.visual.force.com/jslibrary/1637251310242/sfdc/VFRemote.js:125

    connect https://--c.na103.visual.force.com/jslibrary/1637251310242/sfdc/VFRemote.js:93

    addProvider https://--c.na103.visual.force.com/jslibrary/1637251310242/sfdc/VFRemote.js:85

    add https://-c.na103.visual.force.com/jslibrary/1637251310242/sfdc/VFRemote.js:136

    <anonymous> https://--c.na103.visual.force.com/apex/MyApexClass?id=0063a00000m0iayAAA:8

Source map error: Error: JSON.parse: unexpected end of data at line 1 column 1 of the JSON data Resource URL: https://c.na103.visual.force.com/jslibrary/1637251310242/sfdc/VFRemote.js Source Map URL: /javascript/1678263374973/sfdc/source/VFRemote.js.map
Prateek Prasoon 25Prateek Prasoon 25

The PageReference code you have provided seems correct and should work in most cases. However, if it is not working specifically in Firefox, there may be some browser settings or extensions that are preventing the redirect from occurring.
One common reason why a redirect might not work in Firefox is due to the Enhanced Tracking Protection feature. This feature can sometimes block redirects to third-party sites, including Salesforce. To fix this issue, you can add Salesforce to your list of exceptions in Firefox’s settings.
Here’s how you can add Salesforce to your list of exceptions in Firefox:

Click on the menu button (three horizontal lines) in the upper-right corner of the Firefox window.
Click on “Options” (or “Preferences” on macOS).
In the left-hand pane, click on “Privacy & Security”.
Scroll down to the “Enhanced Tracking Protection” section and click on the “Exceptions...” button.
In the “Address of website” field, enter the URL of your Salesforce org (e.g., https://your-org-name.my.salesforce.com) and click “Save Changes”.
If this does not resolve the issue, you can try clearing your browser cache and cookies, or disabling any browser extensions that might be interfering with the redirect.
I hope this helps! Let me know if you have any further questions.

If you find this answer helpful, Please mark it as the best answer.
TobyKutlerTobyKutler
Hi Prateek, I think you are on the right track with a browser setting I did add the Salesforce domain to the Enhanced Tracking Protection but still not redirecting. It looks like the browser is initiating the HTTP request but then is blocked. I cannot seem to find what exact setting is causing this in Firefox. I cleared the cache, the browser has no extensions, and is also the latest version. Let me know if you have any other idea what setting it could be
TobyKutlerTobyKutler
I should also note that I installed Firefox completely new and got this problem. It seems to be a problem with Firefox right Out-Of-The-Box since I did nothing before testing the feature and installing the app.