Is there any option for SharePoint global navigation which is compatible with SharePoint Server 2013 and SharePoint online?

I’m currently using SharePoint 2013 and want to build a custom global navigation for the whole farm which is also migratable to SharePoint Online. In SharePoint Online i use the modern environment. The masterpages or composed looks aren’t available in that kind of SharePoint Online and the Framework doesn’t work with 2013. Is there another option for a global navigation which is working for both variants of SharePoint?

Best regards