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
Baguiar2Baguiar2 

User in development mode execution of Javascript

Hello!

 

I've noticed that if I enable "Development mode" on the user (myself) and create a VF page with a javascript that has a "navigatetoURL('http://www.google.com')" it works just fine. Now, If I disable "devfelopment mode" on the user, all the javascript works fine, EXCEPT for the navigatetoURL.

 

IS there a way to have tis working on any user ?

 

Thanks!

B

Best Answer chosen by Admin (Salesforce Developers) 
Navatar_DbSupNavatar_DbSup

Hi,

 

Try the below Code as reference:

 

<apex:page >

<script>

function movetonewlocation()

 {

   try

   {

  

 //   var url='http://www.google.com';

 //   window.location.href= url;

     navigateToUrl('http://www.google.co.in/');

    return false;

  }

  catch(ex)

  {

   alert(ex);

  }

 }

</script>

  <apex:form >

  <apex:commandButton value="Go To Google" onclick="movetonewlocation();" oncomplete=""/>

  </apex:form>

</apex:page>

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 

 

 

All Answers

Navatar_DbSupNavatar_DbSup

Hi,

 

Try the below Code as reference:

 

<apex:page >

<script>

function movetonewlocation()

 {

   try

   {

  

 //   var url='http://www.google.com';

 //   window.location.href= url;

     navigateToUrl('http://www.google.co.in/');

    return false;

  }

  catch(ex)

  {

   alert(ex);

  }

 }

</script>

  <apex:form >

  <apex:commandButton value="Go To Google" onclick="movetonewlocation();" oncomplete=""/>

  </apex:form>

</apex:page>

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 

 

 

This was selected as the best answer
Baguiar2Baguiar2

That was it! Thanks AGAIN Navatar. 

 

What really made a diference here was the  oncomplete="". That's what made a user NOT in dev mode be able to navigate to a dif URL.