Besat
Besat

Reputation: 1438

I get Failed to load error in Electron application

I am trying to link a font to my Electron app but I get this error

Failed to load resource: net::ERR_CONNECTION_REFUSED

I have added this to my CSS

@import url(https://fonts.googleapis.com/css?family=Open+Sans:400,700); 

I have even tried adding this to my html:

<link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Open+Sans" />

I have also tried:

<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Open+Sans" />

<link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Open+Sans" />

any help is appreciated.

Upvotes: 2

Views: 5231

Answers (2)

Roy Wood
Roy Wood

Reputation: 350

The sample electron boilerplate app includes a line like this in the main electron startup code:

app.commandLine.appendSwitch('host-rules', 'MAP * 127.0.0.1');

If your code includes that, then all network requests are going to be re-routed back to localhost, which will be a problem.

If that line of code is in your electron startup code, try commenting it out...

Upvotes: 4

Maths RkBala
Maths RkBala

Reputation: 2195

You missed the ":" try the following:

<link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Open+Sans" />

Upvotes: 0

Related Questions