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
Salesforce 283Salesforce 283 

Location.href is not working in google chrome

Hi Guys,
Location.href used in custom button, its working in firefox but not working in google chrome.

Arunkumar RArunkumar R
Hi Gopi,

    Hope you are trying open page in existing window. If yes, did you tried the below one,
window.location.href = ''

Above one works in both chrome and firefox.
Salesforce 283Salesforce 283
Hi Arun, I tried that one but not working. *location.href = '/servlet/servlet.FileDownload?file=' + docId; * i used this. Thanks, gopi.
Salesforce 283Salesforce 283
Hi Arun, Dont open any new window. i want to download in current page itself. Thanks, Gopi.
Amita TatarAmita Tatar
Hi Gopi, i am facing the same issue. Once i click on save button it should open the print invoice page in new tab and refresh the existing page.
But it is not working in chrome browser.
<apex:commandlink action="{!save}" target="_blank">
        <apex:commandButton id="saveBtn" action="{!save}" value="Save" onclick="window.location.href('');"/>

Please help me out here

Thanks & Regards,
Amita Tatar