RE: How to get session ID through JavaScript?
It is in sessionStorage, pretty easy to read
var storage = window.top.sessionStorage;
var sessionId = storage.getItem("UNEXPECTED_TERMINATION");
Hope, that can be useful to someone who are facing the same issue, sometime, sessionId will take 1 second to load, so add a timeout statement over will be a great idea