cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Disable apple-mobile-web-app-capable

maartnf
Participant
0 Likes
1,545

Hello,

We are currently developing a sapui5 application which should run as a standalone web application. The user authentication is done with OAuth2. When running the application from the iPad home screen, this is done in a 'headerless' browser (no navigation, no address bar,...). When checking the source of the application, there is indeed the meta-tag apple-mobile-web-app-capable which is set to true. No tricky parts here...

The problem we experience is the application navigates to different non-sapui5 applications. There is no navigation provided in these applications so we can't go back to the sapui5 application. Therefore we want to disable the apple-web-app-capable meta-tag, but (for now) this isn't working...

After reading the sapui5 docs, I didn't find a way to disable the meta-tag. I already tried to change the value of the meta-tag and also removing it completely using javascript, but this doesn't seem to work because of the redirects that are performed to authenticate the user through OAuth2. Is there a way to disable this behavior through the sapui5 runtime? (did I miss something in the docs...) Or did anyone manage to disable this through javascript? Or is there another solution? 🙂

The sapui5 version we are currently using is 1.20.1

Kind regards,

Maarten

Accepted Solutions (1)

Accepted Solutions (1)

maartnf
Participant
0 Likes

After some more searching, I managed to solve it myself... It is solvable by removing the meta-tag (as I already tried), problem was the application already redirected before the code for the removal was executed.

If someone is interested in the javascript code: (plain javascript because it is executed before the sapui5 runtime is loaded)


function removeWebAppCapable(){

     var metaTags = document.getElementsByTagName("meta"),

      deleted = false;

     for(var i = 0, iLength = metaTags.length; i < iLength && !deleted; i++){

          var metaTag = metaTags[i];

          if(metaTag.name === "apple-mobile-web-app-capable"){

               metaTag.parentNode.removeChild(metaTag);

               deleted = true;

          }

     }

}

Former Member
0 Likes

Thanks for sharing this.

I have the same problem.

Can you please explain where exactly I have to call your function removeWebAppCapable()?

Thanks in advance

maartnf
Participant
0 Likes

Hi Alessandro,

I don't think it matters that much, as long as it is performed before a user could create a shortcut to his home screen. As far as I know (but correct me if I'm wrong... ) the sapui5 library won't change/recalculate the html elements in the head of the page. In my case the function is called at the end of the init-function of my Component.js.

Best regards,

Maarten

Answers (0)