No announcement yet.

best place to link external stylesheet - html validation error

  • Filter
  • Time
  • Show
Clear All
new posts

  • best place to link external stylesheet - html validation error


    I love Font Awesome - - as you can see here in my menu

    normaly the referenz schoul be placed in the header section

    <link rel="stylesheet" href="//">
    since i don't now how to modify the header section i placed it in the hedaer section of the menu - it works but ...

    Line 41 Column: 1
    Error: Tag link not allowed here.
    Error Position: <link rel="stylesheet" href="//
    is ther a way in SC to place it in the page header?

    according to there are many more errors.

    any hints here?

    Thanks & Happy eastern,

  • #2
    Not too sure about all the other stuff but aren't you missing the [type="text/css"] attribute in your link-tag? Been a long time since i actually done proper webdevelopment like that but far as I can recall you need the type attribute...

    Far as the problem goes, the error you put in the quote seems to show that the link-tag is cut-off, but I'm assuming that's just a copy-pasting error.

    Oh and after some googling I stumbled upon this:

    <style>@import url(/styles/mystylesheet.css);</style>
    Adding it on runtime does however make it so it might do a first render without the stylesheet then when it's imported do a second render with it rather noticable if a user has poor connectivity. Although on that front I'm uncertain whether you might have the same problem with what you're doing atm.

    Oh and happy easter to you too!
    Last edited by hoihoi661; 04-02-2015, 04:37 AM. Reason: See EDIT


    • #3
      Originally posted by mITSM View Post
      is ther a way in SC to place it in the page header?
      I suspect making a copy of the template your page is using, placing this in the header template and using that template in your menu app is worth a try.


      • #4
        i would have to do this in linux via command prompt? - sorry totally new to SC -

        @ hoihoi661 - thanks - that is what "they" tell me to do , and i think they should now it - hopefully -
        Paste the following code into the <head> section of your site's HTML.
        <link rel="stylesheet" href="//">
        Last edited by mITSM; 04-04-2015, 06:02 AM.


        • #5
          Originally posted by mITSM View Post
          i wolud have to do this in linux via command prompt? - sorry totally new to SC -

          In your app config, Menu ==> Layout ==> Visual Settings will show you the header template your menu app is currently using.

          Then from main menu, Layout ==> HTML templates will allow you do what I enumerated.


          • #6
            put it in onApplicationInit of the menu


            • #7
              eventually I made myself not clear enough.

              Is ther a way do modify the <head> section of the HTML OUTPUT - all the solutions above have the result that the

              <link rel=\"stylesheet\" href=\"//\">;

              is in the body section - AND ist only valid for teh "one" application not for ALL
              Thanks in advanced

              Last edited by mITSM; 04-11-2015, 03:15 AM. Reason: add image


              • #8
                @ scriptcaser - thanks for your solution - that is how i do it , but then it is in the <body> part of the html-output but I need to have it in the header

                @gerd I tried "include <link rel=\"stylesheet\" href=\"//\">;" but no result at all - blnak page AND i guess it woul also be in the <body> part


                • #9
                  attached a sample source , put it in a menu-onApplicationInit.

                  The result will be this:

                  Attached Files


                  • #10
                    hi Gerd

                    thank you - getting closer but the link is still in the body-section not in the header -


                    cu rob


                    • #11
                      Did you ever solve this? I have the same need.


                      • #12
                        I never tried it, but jquery can add stuff to the head element:

                        $('head').append('<link />');


                        • #13
                          Hi there! I know it's an old question, but for anyone trying this, as for version 9 of scriptcase (2019), you can put code inside the <head> tag of the HTML if you run the code in the event "onScript Init.

                          The documentation exemplifies this with the incorporation of libraries

                          Best Regards

                          Daniel Salcedo
                          • Software & Hardware developer
                          • Photography enthusiast
                          • Ultimate Frisbee lover