I'm using JSON.stringify()
with a custom replacer to stringify the window
object of a given page. On some pages I understandably get the same-origin-policy error that interrupts the execution. What I would like to do is to safely handle the restricted access requests that cause the error by skipping them and continue with the rest of the execution. I could catch the error outside of JSON.stringify()
but there is no point as the execution has already stopped...
Is this possible? If not, any other suggestions to get rid of a large object's circular references like window
as I'm using JSON.stringify()
to get rid of circular references in the first place