cancel
Showing results for 
Search instead for 
Did you mean: 

Favicon

former_member394902
Contributor
0 Kudos

Hi,

I want to put a favicon in the portal. I have put the favicon.ico in the root of the webserver i.e. <SID>\JC01\j2ee\cluster\server0\apps\sap.com\irj\servlet_jsp\irj\root

Modified the HeaderiView.jsp in masthead.par to add the following line


<head>
<link rel="icon" href="favicon.ico" type="image/x-icon" />
</head>

Now when i launch the portal the favicon appears in the address bar. But this is working only on Mozilla Firefox. I cant see the favicon in IE.

Anybody any ideas?

Many Thanks,

Akhilesh

Accepted Solutions (1)

Accepted Solutions (1)

darrell_merryweather
Active Contributor
0 Kudos

Hi

We@SDN also had problems with IE. It appears that IE has real problems with favicons when using HTTPS. It normally works on HTTP, but we can't get it to work on HTTPS. I believe the only way of doing this is for the URL to the icon, as mentioned below, is using an absolute URL using http, instead of HTTPS

I hope this makes some sort of sense

D

former_member394902
Contributor
0 Kudos

Hi Darrell,

I am not using HTTPS. The favicon does not appear in HTTP also. Any ideas?

Thanks, Akhilesh

darrell_merryweather
Active Contributor
0 Kudos

In which case its probably because IE uses the icon as a favourites icon.

Make sure you have this code in the output HTML

<link rel="ICON" href="favicon.ico" type="image/x-icon" />

<link rel="SHORTCUT ICON" href="favicon.ico" type="image/x-icon" />

Then, load the page in HTTP and add the page to your favourites. This should get saved with the icon. Then, any subsequent accesses you should get the icon in the address bar.

I have just tried this with SDN, using HTTP, and it works fine

D

former_member394902
Contributor
0 Kudos

Hi Darrell,

I put teh lines of code that you sent in the <head> tag of my masthead iview. The image is in the \irj\root folder.

When i launch the portal and view source the following is there

<head>
<link rel="ICON" href="favicon.ico" type="image/x-icon" />
<link rel="SHORTCUT ICON" href="favicon.ico" type="image/x-icon" />
</head>
<script defer language="JavaScript">ur_system.is508=false;ur_language="en";;</script><script defer>sapUrMapi_Focus_RegisterCreate(null,event)</script><!--<a href="#" tabindex=0 title= "Beginning of Page" accesskey="m">
  <img src="/irj/portalapps/com.sap.portal.design.portaldesigndata/themes/portal/rt/rtstd/prtl/../common/1x1.gif" border="0" style="display:none">

and much more..

Still no icon in the address bar?

1.Is there some specific place i need to add the <link rel... /> or can i add it in any component as long as that gets loaded when the portal loads?

2. does the size of the icon matter? mine is 32X32 px icon.

Thanks, Akhilesh

darrell_merryweather
Active Contributor
0 Kudos

As long as the image link is in the <head></head> it should be fine.

Our icon is 16x16, but not too sure whether this makes any difference. Does it work in Firefox ?

former_member394902
Contributor
0 Kudos

Yes, the 32X32 px icon works in Firefox.

darrell_merryweather
Active Contributor
0 Kudos

If you access SDN via HTTP and save the homepage as a favourite, does it store the SDN image as the icon.

If this does work, then I would check the HTML against the HTML you have to make sure that it is the same. If this doesn't work for you, then I am unsure as to what else to suggest

D

former_member394902
Contributor
0 Kudos

Hi Darrell,

If i access SDN via HTTP i can see the favicon. Yes, you are correct the HTML looks different in SDN and my portal. In SDN the following lines are at the top before any component is rendered

<link rel="ICON" href="https://answers.sap.com/irj/portalapps/com.sap.sdn.framework.lite/images/sdn.ico" type="image/x-icon" />
<link rel="SHORTCUT ICON" href="https://answers.sap.com/irj/portalapps/com.sap.sdn.framework.lite/images/sdn.ico" type="image/x-icon" />

Whereas in my code, since i have modifed the masthead to include these lines, they appear much down in a sepaarte <HEAD> section. the link inclusion is not in the standard portal <HEAD> section which also has CSS etc files.

Can you let me know what component in SDN adds the favicon in the <HEAD>?

Thanks, Akhilesh

darrell_merryweather
Active Contributor
0 Kudos

Ahahahah. We have the problem then. You are not supposed to have multiple <head></head> sections in HTML, and I believe the second <head> section will be ignored. This is why it isn't working.

Ok, I believe that there are several ways in which you can accomplish this.

1)You can create a DocumentHook. This is similar to a user exit, where your code will be executed at certain points within the page building. This should be documented on help.sap.com.

2) You can create a simple component which can manipulate the HTML document directly before it is output to the client. You can do this using the following code

IPortalNode portalNode = request.getNode().getPortalNode();
IPortalResponse portalResponse = (IPortalResponse)portalNode.getValue(IPortalResponse.class.getName());
HtmlDocument htmlDocument = null;
if ( portalResponse instanceof PortalHtmlResponse ){
  PortalHtmlResponse htmlResponse = (PortalHtmlResponse)portalResponse;
  htmlDocument = htmlResponse.getHtmlDocument();
  HtmlHead head = null;
  if ( htmlDocument != null ){
    head = htmlDocument.getHead();
    htmlHead.addElement(toAdd);
  }
}

I hope this helps

Darrell

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Akhilesh,

We r also tring to put our portal favicon, but we can't find where we cahange that code :

<head>

<link rel="icon" href="favicon.ico" type="image/x-icon" />

</head>

pls give me exact path

thanks for advance

Navaneethan

navaneethan.81@gmail.com

Former Member
0 Kudos

Hi Akhilesh,

have you created a real .ico or just renamed a .gif or .bmp to .ico? IE is very strict with handling of non-real .ico files.

Give this a try: in IE click and hold the little IE icon to the left of "http://...." in the adress bar of IE. Drag it some millimeters to the right and release the click. Repeat this several times - maybe the icon is appearing like magic

Maybe delete the type declaration in the link. Just a try...

Hth,

Michael