Because ServiceNow is a framed application, I often get asked by customers how to deal with any potential nested frame issues.

There are many ways to handle this, but often times it boils down to just inserting frame-busting javascript code in the right place.

An HTML document with the following javascript code snippet will detect if it is being displayed within a frame as it loads. If it is, it will break out of the frame and show that page as the main document in the browser.

Here is the code:

1
2
3
        <script type="text/javascript">
          if(top != self) top.location.replace(location);
        </script>

This code snippet is designed to go within the BODY of the HTML document.