OL Learn

Prevent Connect from inserting CSS-Link in website header


I create on demand websites through Connect Designer (in a Workflow configuration). The PlanetPress Connect Server is a backend machine, while the other one is the webserver (webserver sends an request to the backend server to get the website). So I store all website resources (CSS, JS, images, etc.) on the webserver machine.

Connect automatically inserts the following CSS-Link in the header of every website.

<link type="text/css" rel="stylesheet" href="generated/__ol__font_definitions.css?lm=1582786381043">

That link can not be found from browser and in the console I get “__ol__font_definitions.css:1 Failed to load resource: the server responded with a status of 404 ()”.

How can I prevent Connect from inserting that link or how can I modify the link before sending it back to the webserver machine?

Have you tried removing it with jQuery or better yet, just disabling it?

$('link[href*="__ol__font_definitions"]').prop('disabled', true);

I’m not sure if you use .remove() whether the DOM will know it’s gone until you refresh.

Thank your for your reply. I tried the following before and it works, but its too late, because the css-link will be in dom and will be executed before I can remove it via javascript/jquery.

$('link[href^="generated/__ol__font_definitions.css"]').attr('disabled', 'disabled');

Yes, that is what I feared. Hmmm…could we remove it in Scripts by targeting head before the page is created? That is, if it’s there at this point of course…

Ok, it was my mistake. I tried two things without success:

  1. deactivate and remove that element in a javascript
  2. deactivate and remove that element in a Connect script with selector “head”

The right way is to deactivate and remove the element within a Connect script with selector “html” with following code:

query('head link[href^="generated/__ol__font_definitions.css"]').attr('disabled', 'disabled');
query('head link[href^="generated/__ol__font_definitions.css"]').remove();

Great, glad you managed to solve it. I was convinced it would be in the Scripts pane as that’s pre-merge and you needed to remove it before it made it to the DOM.

Good to know if I run into this problem also.