Check out example codes for "how to do Employing defensive code in the UI to ensure that the current frame is the most top level window in c#". It will help you in understanding the concepts better.

Code Example 1

      <add name="X-Frame-Options" value="SAMEORIGIN" />

Code Example 2

    try {
        if (top.location.hostname != self.location.hostname) throw 1;
    } catch (e) {
        top.location.href = self.location.href;

Learn ReactJs, React Native from