Skip to Content

2 Comments

You must be Logged on to comment or reply to a post.

  1. Boghyon Hoffmann

    An alternative way to set (not only) a favicon is to use the property homeIcon from sap.m.Shell or the API jQuery.sap.setIcons. In this way, the favicon can be retrieved dynamically which will be then appended to the document once it’s ready.

    With Shell:

    sap.ui.getCore().attachInit(function() {
    	sap.ui.component({
    		async: true,
    		manifestUrl: "manifest.json"
    	}).then(function(createdComponent) {
    		sap.ui.require([
    			"sap/m/Shell",
    			"sap/ui/core/ComponentContainer"
    		], function(Shell, ComponentContainer) {
    			new Shell({
    				homeIcon: {
    					favicon: "img/favicon.ico",
    					phone: "icon/logo_57px.png",
    					"phone@2": "icon/logo_114px.png",
    					tablet: "icon/logo_72px.png",
    					"tablet@2": "icon/logo_144px.png",
    					precomposed: false // whether the home icons already have some glare effects (for iOS)
    				},
    				showLogout: false,
    				app: new ComponentContainer({
    					component: createdComponent,
    					height: "100%"
    				})
    			}).placeAt("content");
    		});
    	});
    });

    Without Shell:

    sap.ui.require([
    	"jquery.sap.global"
    ], function(jQuery) {
    	jQuery.sap.setIcons({
    		favicon: "img/favicon.ico",
    		// ...
    	});
    });

     

    (5) 

Leave a Reply