+ 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.


Thanks,
Gopi.
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 = 'https://www.google.com'

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('https://c.ap2.visual.force.com/apex/CafeList?sfdc.tabName=01r28000000mltJ');"/>
        </apex:commandLink>


Please help me out here

Thanks & Regards,
Amita Tatar