I have a VF page running in SF1. I need to redirect to another page by using javascript. I am using below code

 <p><a href="javascript:var x = 'https://cs5.salesforce.com/a06O000000JWnJhIAL';   sforce.one.navigateToURL(x);">Click to open page two.</a></p>

This code is not redirectiong me to the second page but if I remove variabale x and hard code the redirection url it is working Below is the working

  <p><a href="javascript:    sforce.one.navigateToURL('https://cs5.salesforce.com/a06O000000JWnJhIAL');">Click to open page two.</a></p>

Now the imapct is I cannot make the url dynamic any way to achecive dynamic redirection?


Your original code is working fine for me in the HTML5 version from the desktop, iOS and android, and the installed app for iOS (I don't have an android device with the installed app to hand so I can't test that).

I'm using dynamic navigation to pages based on JavaScript variables in a number of places - generated as a string by decoding a barcode for example in the following post:


If you see this behaviour on the desktop (via the /one/one.app URL), have a look at the google chrome inspector to see if there are any JavaScript errors - though I can't see any reason why this would be the case.

  • Its not working for me in iPad Mini and android(Samsung Galaxy Grand) killing our time. Any suggestion from your side? Apr 10 '14 at 8:10
  • In desktop sforce is defined and stil not redirecting Apr 10 '14 at 8:14
  • I've just tested it on an ipad mini and its working fine - the link I've set up is the full URL to an account and I get taken straight there. Apr 10 '14 at 8:15
  • Ok did you use hardcoded url or dynamic one? Apr 10 '14 at 8:22
  • is it a vf url or standard page url Apr 10 '14 at 8:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.