3

I'm working on an JS on VF app that utilizes hashtag routing ie: https://c.na17.visual.force.com/apex/ionicOne#app/account/001o0000006w1pBAAQ

When I Access my app via Visualforce: ie: /apex/ionicOne My app behaves normally and utilizes xhrs to load various templates and change state via hashtag url routing. It generates urls like

https://c.na17.visual.force.com/apex/ionicOne#/app/account/001o0000006w1pBAAQ

However, when I access the same application via sf1 (ios / one/one.app) I see that SF1 has re-written the href links to look like this:

https://c.na17.visual.force.com/apex/ionicOne?sfdc.tabName=01ro0000000EXbp&isdtp=p1&sfdcIFrameOrigin=https%3A%2F%2Fna17.salesforce.com&sfdcIFrameHost=web#/app/account/001o0000006w1pBAAQ

Aside from being weird, this also has the side effect of breaking my entire app navigation as every tap results in a full sf1 reload.

eek. Anyone know how to keep sf1 from mucking with my hrefs ?

3

So I discovered the proximate cause of my issue.

Salesforce1 seems to know how to properly parse and carefully re-write links that are encased in

<a> foo </a> 

Tags. However, in my case I was using an Angular directive (ion-item) from Ionic, with an href attribute that angular compiled-down-to a link client side. This fails and SF1 reloads the master sf1 page.

The fix options are:

  1. Wrap navigation links in <a> tags. Ugly.
  2. We write a directive that client side mimics the url munging that SF1 is doing server side. (or somewhere.)

For today, I've done #1, longterm I'll likely contribute an OSS ionic plugin module for SF1 to provide for this. perhaps a href filter.

| improve this answer | |
0

We came across this same issue a while ago, and the bad news is, there is no way from stopping SF1 from interfering with HashBang URLs..

We resorted to using client side navigation using the standard salesforce objects. (sforce.one)

  1. Detect if the URL Contains /one.app
  2. Use sforce.one.navigateToURL(url, isredirect)

Some Usefull Links,

| improve this answer | |

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.