PageIcon

data class PageIcon(val rel: Relationship, val url: String, val sizes: String, val mimeType: String, val precomposed: Boolean = rel == Relationship.APPLE_TOUCH_ICON_PRECOMPOSED, val length: Int = -1) : Icon

Icon information associated with the Web page.

e.g. Assuming that the URL of the site is https://www.example.com/index.html

When the HTML tag is

<link rel="apple-touch-icon-precomposed" href="/apple-touch-icon-precomposed.png" sizes="120x120">

the following values are stored

rel=APPLE_TOUCH_ICON_PRECOMPOSED
url=https://www.example.com/apple-touch-icon-precomposed.png
sizes=120x120
mimeType= <- empty
precomposed=true
length=-1 <- always -1

When the HTML tag is

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

the following values are stored

rel=ICON
url=https://www.example.com/favicon.ico
sizes= <- empty
mimeType=image/x-icon
precomposed=false
length=-1 <- always -1

Constructors

Link copied to clipboard
constructor(rel: Relationship, url: String, sizes: String, mimeType: String, precomposed: Boolean = rel == Relationship.APPLE_TOUCH_ICON_PRECOMPOSED, length: Int = -1)

Properties

Link copied to clipboard
open override val length: Int

Icon file length.

Link copied to clipboard
open override val mimeType: String

Icon MIME type. e.g. "image/png"

Link copied to clipboard
open override val precomposed: Boolean

true if this is for a precomposed touch icon.

Link copied to clipboard
open override val rel: Relationship

Relationship between icon and page.

Link copied to clipboard
open override val sizes: String

Size information, assumed format is (width)x(height). e.g. "80x80".

Link copied to clipboard
open override val url: String

Icon url.

Functions

Link copied to clipboard
open fun inferArea(): Int

Infer area of this icon.

Link copied to clipboard
open override fun inferSize(): Size

Infer display size of this icon from sizes value.