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
V K AV K A 

Closing the embedded browser containing the Visualforce page and returns the user to the originating tab or record.

Hello.

I have VF Page in Salesforce Classic in Andorid. I need to close that VF Page after saving the Records and go to Previous Record.

am using the Java Script functionalties provied in Salesforce Help Page to achive this, but its not working and give me the Error of Web page at Mobileforce:///Close migh be temprorily down or it may have moved Permanently to a new web Address.

Here is the link : https://www.salesforce.com/us/developer/docs/pages/Content/pages_mobile_javascript_library.htm

any help is appreciaed.

Thanks.
techcharlietechcharlie
If your visualforce page has a custom controller you can specify the page redirect in your Save method, eg

public pagereference mysave() {
     try{
      //save your record
       
     }catch(DmlException ex){
   ApexPages.addMessages(ex);
 
     }      
    
return new pagereference('/'+record.Id);
}
V K AV K A
This kind of redirecting is not working for Salesforce Mobile. I have tried out. Mobile VF Page is diffrent.

Thanks,
Vinoth

techcharlietechcharlie
Apologies, I missed the moile bit. Can you post a copy of your code that contains the javascript function mobileforce.device.close()?
Have you used your browsers debug tool to look for any javascript errors?
V K AV K A
Below is the VF Page. No option is working.



<apex:page >
<apex:form >
<html>
<head>

    <script type="application/x-javascript" src="http://na1.salesforce.com/mobileclient/api/mobileforce.js"></script>
    <script>
    function doClose() {
        mobileforce.device.close();
            return false;
    }
       
    </script>
</head>
<body>
        <a href="mobileforce:///close">HTML close</a><br/>
        <br/>
        <br/>
        <a href="#" onclick="return doClose();">JS close</a><br/>
        <br/>
        <br/>
        <apex:commandButton value="Click"  onclick="return doClose();" />
   
</body>
</html>
    </apex:form>
</apex:page>