Mike
Mike

Reputation: 857

Adding image in the <title> for all pages

I am able to add an image as part of my web application title but what I need to know is that, if there is a way in CSS or any other way to set this image for all the pages at once instead of adding it in the head tag for each and every page.

<link rel="shortcut icon" href="../images/favicon.ico" />

Thanks

Upvotes: 0

Views: 425

Answers (2)

user1183772
user1183772

Reputation:

You can have that link tag inside another .jsp file and include it anywhere you like writing <%@include file="includes/header.jsp" %>.

header.jsp will contain the favicon and maybe css that you want to use everywhere:

<link rel="shortcut icon" href="../images/favicon.ico" />

Using this include pattern you avoid repeated code and having to edit lots of files if your favicon url changes. A great example to illustrate this is to have a .jsp file for the navigation and include it everywhere in your website. This way if you want to add another page to the navigation you just have to edit one file.

Upvotes: 1

Web2Me
Web2Me

Reputation: 11

You'll need to use php include, cause you can call it in every page and you only need to code it one time...

For example, you write your head with php extension(head.php) and then you use on your pages

include 'sourcefile/head.php';

then everything that you coded will be post there.

hope it helps

Upvotes: 1

Related Questions