Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8499275
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T00:37:20+00:00 2026-06-11T00:37:20+00:00

I have a WebView in a Cocoa application (macgap). ( NOTE I’m not talking

  • 0

I have a WebView in a Cocoa application (macgap).

(NOTE I’m not talking about a UIWebView in an iOS app)

In my CSS file, there are some custom font declarations:

@font-face{
    font-family:'Quivira';
    src:url("./Quivira.ttf") format("truetype");
    font-weight:normal;
    font-style:normal;
}

I can’t get these to load however – some sort of security issue I believe.

Sometimes, I can see there is an error in the console “Not allowed to load local resource: Quivira.ttf” (it doesn’t always show this though)

What could be causing this? The index.html file is loaded via the file:/// protocol so there shouldn’t be a security issue, as it is already local and should therefor be able to load local resources.

I’m thinking it could be a bug in webkit.

Is anyone able to load custom fonts in a Cocoa WebView?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T00:37:22+00:00Added an answer on June 11, 2026 at 12:37 am

    I have tried two approaches to load webpages with custom fonts.

    • From the app bundle (using NSBundle)
    • From a local path specified by the user (using absolute path)

    In both cases I am successfully able to display Custom Fonts. There is a HTML file and beside it, a .ttf font file. In the HTML file I have defined @font-face in inline CSS.

    In the second case you can give any full path from local filesystem and the webview will load from that (like /Users/johndoe/Desktop/maiwebsite/index.html).

    Code is on Github.

    And from another answer on SO:

    1. Instead of getting the resource path and stapling a subpath onto it yourself, ask the bundle to give you the correct path.
    2. Instead of handling a path at all, ask the bundle to give you the correct URL. (Requires Mac OS X 10.6 or later.)

    If this doesn’t help then could you put up your code somewhere so we can try to debug it?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an webView in a Cocoa application which I edit the contents programatically.
Within a Cocoa application I have a webview. When Google's personalized home page loads
In my cocoa application I have a WebView. If I set that WebView to
I have a webview in an iOS App. I have a select box with
I have a Cocoa app that embeds a WebView. I'd like to intercept a
I have a WebView displaying a HTML page, linking to a CSS file. The
I have an embedded WebView in my Cocoa application in which I load an
I have a cocoa application which contains a webview. Inside the webview is essentially
I have a cocoa application which is a fullscreen webbrowser using WebView. Initially the
I have a Cocoa app that uses a WebView to display an HTML interface.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.