leonbreedt / FavIcon

Swift library to detect icons supported by a website.
Other
126 stars 37 forks source link

Link rel generated by Javascript is not properly evaluated #32

Open vladimir-aubrecht opened 4 years ago

vladimir-aubrecht commented 4 years ago

Some pages are generating url to link rel by javascript, but FavIcon currently cannot evaluate it and as a result icon is not recognized.

Sample webpage: https://www.dcuniverse.com/ Actual link: <link rel="icon" href="{{\'images/favicon.ico\'| buildPath}}" type="image/png"> Expected link: <link rel="icon" href="https://www.dcuniverse.com/builds/892ed368/images/favicon.ico" type="image/png"> Correct href: https://www.dcuniverse.com/builds/892ed368/images/favicon.ico

leonbreedt commented 4 years ago

@vladimir-aubrecht wow, ok, this will be hard to fix, since we just use URLRequest, and then parse the HTML without further interpretation.

the only way I can see this working would be to spin up a webview of some kind, use that in a headless mode, waiting for some signal that the JS has finished rendering the template, and then walking the DOM to navigate the <link> elements.

every day, frontend guys do something new to surprise me :)