A big thanks to Jorge Almeida, one of our community members, for submitting this how-to.
How to set a Favicon associated with your OutSystems application?
In OutSystems, by default, the Favicon displayed for applications is the OutSystems logo. Favicon is the icon visible for your app in the browser and is also known as shortcut icon, website icon, tab icon, URL icon or bookmark icon.
To use a custom Favicon for your applications:
- Add the
AddFaviconTagaction, included in the HTTPRequestHandler extension, as a dependency of your application.
AddFaviconTag, allows setting the favicon for the current page;
- Import the source file of the icon you want to use as an image or upload the file as a resource.
- Call the
AddFaviconTagaction from the preparation of the screens where you want to display it.
STEP1 - Add AddFaviconTag action as a dependency
- Click on Manage Dependencies...:
- Search for HTTPRequestHandler on the left pane and select it toview its public elements.
- Select the
AddFaviconTagaction to use it in your application.
STEP2 - Add the source file of the icon
You can add the source file for your icon using one of two methods, importing the icon to the images folder or uploading it to the resources folder of your application. For favicon you should use a small image with the same width and height, typically 16 pixels by 16 pixels (or its multiples). Allowed image formats are png, jpg and gif.
Method #1 - uploading as an image
In the Interface tab, right-click on the images folder and click on Import Image... to upload the icon to the images folder.
Method #2 - uploading as a resource
- Create your .ico image using, for example, this website http://www.favicon.cc/. Be careful not to rename it as favicon.ico (as this is the default name looked up by browsers).
- Go the Data tab and scroll down all the way until you find the Resources folder.
- Right-click on the Resources folder, click Import Resource and then select your image or logo:
- Select Add as Resource in the popup that shows up.
- In the properties of the new resource, set the Deploy Action property, to
Deploy to Target Directory.
STEP 3 - Call the
To set the same favicon across all screens of your application, an option is to call the
AddFaviconTag from the Menu web block, as this block is already injected into all application screens. To do this:
- In the Interface tab, navigate to the Menu web block, located under the Common UI Flow. Select the Menu web block and add a Preparation action. In flow of the Preparation action, call the AddFaviconTag action
- Open the property editor by double-clicking on the IconFilename property and set the IconFilename property to IconFilename property and set the IconFilename property to
img/is the directory from where the Platform deploys images during publishing;
<file_name>.<file_format>is the full name of your icon or logo. The file format should be set to png, jpg or gif.
In the example above the value for property IconFilename was replaced by “./img/zepellin.png”.
See it in action
- Publish your application clicking on the 1-Click Publish button or by pressing F5.
- Confirm the image was correctly deployed by visiting the URL for the resource
https://<your_application_path>/img/<your_filename>.<format_filename>if you imported your icon to the images folder.
In this example, the working application was called "Favicon" and the URL for the image was https://(...). outsystemscloud.com/Favicon/zepellin.png.
This image is quite large (128px by 128px,a multiple of 16 px by 16 px) but when used as favicon it will be resized by the browser.
Visit your app to see your new favicon.
- How to deploy a favicon across all of your applications (forum discussion)-