WhatFont-Bookmarklet icon indicating copy to clipboard operation
WhatFont-Bookmarklet copied to clipboard

Can't view font in very simple pages

Open Wilfred opened this issue 11 years ago • 2 comments

I did write a tweet referencing a JSFiddle, but I suspect that's just an iframe issue. My issue occurs without an iframe. With the following HTML:

<!DOCTYPE html>
<html>
    <head>
        <title>
        </title>
        <link href="cursive.css" rel="stylesheet">
    </head>
    <body>
        <span class="cursive">what font am I, whatfont?</span>
    </body>
</html>

And the following stylesheet:

span {
    font-family: Cursive;
    border: 1px solid green;
}

I can't start whatfont, clicking the icon doesn't do anything.

Wilfred avatar Jul 16 '13 11:07 Wilfred

If you run that code on your local machine (via the file:/// protocol), WhatFont cannot run (as you said). If you run that code on a web server (not via the file:/// protocol), WhatFont works fine.

The issue is not with WhatFont. The issue is that Chrome extensions (i.e. WhatFont) are not allowed to run in pages loaded via the file:/// protocol for security reasons. This is a JavaScript security feature to prevent malicious web pages from accessing your files.

Fixes #6

morgansoftware avatar Dec 12 '15 01:12 morgansoftware

I'd really like this too. I know this likely wouldn't be possible on the bookmarklet, but seems like it could be on the Chrome extension. Take a look at how the Chrome extension Stylus is doing it maybe @chengyin? They have an option called "Allow access to file URLs" that does exactly this. :)

image

adamculpepper avatar Jan 14 '20 18:01 adamculpepper