You just let the javascript send a heartbeat ping. If you don't receive the ping but served the page you can determine that the user agent did not execute the javascript.
In any case, first-party isolation can be subverted: https://news.ycombinator.com/item?id=17947605