문제

I'm using PHP to display an image (dynamically returning a binary blob with a mime type of image/png for example) so that means I can't use the typical method for changing the favicon (link tags).

The HTML solution is this:

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

Is there a way I can set the favicon in PHP for a non HTML document?

도움이 되었습니까?

해결책

Most browsers will default to looking for a favicon in the root directory like so: http://example.com/favicon.ico. You can use this for a favicon for your images.

If you want different favicons for each image, that's simply not possible (browsers provide no mechanism for this). There is a proposed standard for setting favicons via HTTP headers (RFC 5988) but it's still a draft and hasn't been implemented by browser vendors.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top