One could, but most likely one would need a proper morphological analysis[2] to make it work correctly for the endless possibilities to combine words in German. Pretty hard to implement in the browser, but maybe an 80:20 like approach using a good dictionary could help for common terms in combination with slowdown on terms it doesn't know how to split.
[1] for example, one could use wiktionary data and try to extract how to properly separate common terms: https://de.wiktionary.org/wiki/Schifffahrt
Edit: [2] German demo of how that usually looks http://www.tagh.de/demo.php (not affiliated)