Skip to main content
Question

Alternative for external stylesheet?


geomancer
Evangelist
Forum|alt.badge.img+46

HTML Pages created with FME use an external stylesheet:

<html>
   <head>
      <title>Report</title>
      <meta charset="UTF-8">
      <link href="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/css/bootstrap.min.css" rel="stylesheet">
   </head>
   <body>
      ......
   </body>
</html>

This is somewhat of a problem when FME Flow has no access to this location, as HTML pages displayed from FME Flow Apps in that case will show without this stylesheet, thus maiming the layout.

Are there alternatives for using this external stylesheet, like placing a copy of it somewhere on the FME Flow machine? Then the <head> of the HTML page could point to this local stylesheet.

The stylesheet contains a lot of information, so adding the contents of the stylesheet to the header of the HTML file does not look like a viable option.

2 replies

hkingsbury
Celebrity
Forum|alt.badge.img+50
  • Celebrity
  • January 21, 2025

An approach i’ve used has been to embed the CSS directly in the html

<html>
   <head>
      <title>Report</title>
      <meta charset="UTF-8">


      <style>
          h1 { 
            color: red;
            font-size: 30pt;
          }

          p { 
            font-family: Arial;
          }
      </style>


   </head>
   <body>
      ......
   </body>
</html>

It’s not an ideal approach, but does ensure you can use outputs of the HTMLReportGenerator in environments with locked down networks


geomancer
Evangelist
Forum|alt.badge.img+46
  • Author
  • Evangelist
  • January 22, 2025

I've been trying to add the stylesheet to my FME Flow repository, and accessing it from there, but this gives me an error when viewing the HTML: “Not allowed to load local resource”.

So the best solution for the short term is probably to embed the styles in the HTML file, like you suggested. Not ideal, not pretty, but it works. Thanks!

Does anybody have other ideas?


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings