How to create script to break a web page out of a frame
Using either of the examples below automatically breaks a browser out of any frame that links to your page. Realize that some web services, such as those that translate your web page into another language, may no longer work because they need a frame.
Some services such as website translation and Google images may use frames to display your content. If you break out of the frames these services may also break.
Breaking out of frame using JavaScript
Place the below script in the <HEAD></HEAD> section of your HTML (HyperText Markup Language).
<script>
<!--
if (top.location != location) { top.location.href = location.href; }
//-->
</script>
Users who have JavaScript disabled are not taken out of a frame using this method.
Alternatively, to create a link for users to break out of a frame on your website, add the example code below.
Break out of a frame using a link
<a href="https://www.computerhope.com/" target="_top">Break out of frame</a>