Register CSS file from JavaScript in SharePoint Online

There is a way to register a CSS file in SharePoint Online without any help from server side code. Seems Microsoft created a method called “registerCssLink” and attached it directly to window object (no namespace for this).

registerCssLink('/sites/mysite/SitePages/style.css', function (htmlLink) {
    // Do something here with htmlLink object representing link to CSS file

It might work on SharePoint 2013 and 2010 as well, but I did not tested it yet. I will post the results of the tests once will be completed.