In my Volt app I want to use a custom Favicon in stead of the Volt Favicon.
Is this possible?
I already tried by adding favicon link to a HTML box on the form. But this did not work.
<link href="https://domainname/favicon.ico" rel="shortcut icon">
In my Volt app I want to use a custom Favicon in stead of the Volt Favicon.
Is this possible?
I already tried by adding favicon link to a HTML box on the form. But this did not work.
<link href="https://domainname/favicon.ico" rel="shortcut icon">
Not n expert, but maybe add this inside a css file ?
You can do this by using a way to call an external JS.
Write the following code in the application's onStart event.
app.getSharedData().loadIcon = function (url, callback) {
var head = document.getElementsByTagName('head')[0];
var link = document.createElement('link');
link.rel = 'icon';
link.href = url;
head.appendChild(link);
}
Next, put the following code in the onLoad event of your form.
var url1 = '<<your favicon file url>>';
app.getSharedData().loadIcon(url1,function(){});
You need to set secureJS to FALSE in "Volt Configuration Settings".
Thanks Masahiko, you helped my on the right way.
This only does not replace the standard Volt favicon but adds an other icon link tag to the head.
I adjusted your code a bit so it replaces the existing favicon instead of adding one:
app.getSharedData().loadIcon = function (url, callback) {
var head = document.getElementsByTagName('head')[0];
var link = document.querySelector("link[rel*='icon']") || document.createElement('link');
link.type = 'image/x-icon';
link.rel = 'shortcut icon';
link.href = url;
head.appendChild(link);
}