Is window.history.back() safe to use?
You can read about windows.history Mozilla website. Briefly it explains that history.back() is not different than clicking on the back button in your browser I think that you are overthinking about windows.history.back, but not about window.history object itself!.
If I explain in detail it would be out of the topic, however, I can shortly claim that window.history.pushState() or window.history.replaceState() methods are more worth to worry about. The browser history manipulation is possible. You can also check out about it from : Manipulating the browser history