HTML Link tags stripped from page when saved

HTML Link tags stripped from page when saved

by Rob Clark -
Number of replies: 4

Hi,

I use a couple of <link> tags which reference (href) to css files in the HTML code of my pages.  They worked fine in Moodle 2.7, but when I use them in Moodle 3.9, they get stripped out of the code when I go back to the Atto editor or when I save and display.  Because the code gets removed, the pages don't display with the correct styles.

The tags are:

        <link href="myfolder/css/special-style-sheet.css" rel="stylesheet" type="text/css">
        <link href="https://www.mywebsite.com/css/special-style-sheet.css" rel="stylesheet" type="text/css">

These are at the start of the code for the page.  Does anyone know what these <link> tags would be stripped out of the HTML editor when it switches to WYSIWYG?

Thanks,

Rob

Average of ratings: -
In reply to Rob Clark

Re: HTML Link tags stripped from page when saved

by Helen Foster -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Hi Rob,

As you've found, the Atto editor does indeed strip lots of tags out when you save the page. To stop it doing this for trusted users such as teachers, I suggest you try enabling trusted content in your Site security settings.

In reply to Helen Foster

Re: HTML Link tags stripped from page when saved

by Rob Clark -
Hi Helen,

Thanks for the quick reply. I just tried your suggestion with no luck. I enabled trusted content, and double-checked that it was for Manager, Course Creator, and Teacher, and that I have all three roles assigned in the corresponding course. It's still stripping out the tags. Do you have any other suggestions?

Thanks,

Rob
In reply to Rob Clark

Re: HTML Link tags stripped from page when saved

by Helen Foster -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Hi Rob,

Sorry to hear that enabling trusted content didn't work. The only other suggestion I have is to use the plain text editor rather than Atto. However, if anyone later edits the text using Atto and then saves changes, the tags would again be stripped.

Average of ratings: Useful (1)
In reply to Helen Foster

Re: HTML Link tags stripped from page when saved

by Rob Clark -
Hi Helen,

That worked, thanks a lot. I'll have to remember about the editor. Luckily I'm the only course developer/creator.

You've been a big help, thanks.

Rob