Skip to main content
Participating Frequently
July 21, 2017
Answered

iFrame keeps breaking out

  • July 21, 2017
  • 1 reply
  • 725 views

Hey guys,

Every time I load my website, my iFrame keeps breaking out. This means that the iFrame enlarges to a full screen.

I have a snippet of code in the HTML portion of my page now which seems to do the job.

Code:

<script type="text/javascript">

    window.onbeforeunload = function () {                     

         return "This will end your session";

    }

</script>

Although it seems to work fine in terms of keeping the URL from busting out of the iframe, it loads a prompt: This page is asking you to confirm that you want to leave - data you have entered may not be saved. If someone clicks "leave", the iFrame will enlarge to full screen. When someone clicks "stay", the iFrame will remain as is and not enlarge (this is what I want).

If anyone knows how I can stop this from occurring I would really appreciate your thoughts. Is there any way for it to automatically s"stay"?

Many thanks in advance for any tips you can offer. Not positive, but I think it might be the onbeforeunload which is causing it.

This topic has been closed for replies.
Correct answer Nancy OShea

Oh my, I feel so stupid, never thinking about copyright issues!!!

Do you have any suggestions on how to connect a database to a website and then creating drop down list based off on that database (similar to the one on eBay)? I am not a programmer whatsoever and have no experience.


Yes I know how to create a database and a search feature with filtered results because I understand MySQL and PHP.    But since you don't, there's no easy way to explain it to you.   Also, you're using WIX  for your main website which means you're at the mercy of whatever WIX allows which probably isn't much.

At some point you might want to move from Wix to WordPress which is  MySQL & PHP driven.  WP with the Woo Commerce plugin is a good e-commerce solution for many people who don't know how to work with code.

Nancy

1 reply

Jon Fritz
Community Expert
Community Expert
July 21, 2017

Any chance you could share a link to your site so we can see what's causing your iframe to behave like that?

That isn't "normal" iframe behavior.

WaldoGuruAuthor
Participating Frequently
July 21, 2017

Sure thing! The "compatibility" part is my iFrame

Here it is:

AF Dynamic Air intake System Kit

Jon Fritz
Community Expert
Community Expert
July 21, 2017

It looks like the iframe is being written into the page using javascript (I see no iframe in the source of the page itself before the frame takes over), and somewhere along the line is a frame breaker script.

Is the content of the iframe yours?

I ask because many sites use a javascript frame breaker to keep third parties from using their intellectual property on an unauthorized site.

If it is yours, you should be able comment out all scripts on the iframe source page, and "un-comment" them one at a time until you find the culprit. Hopefully it's not written into your compatibility search function, it may be hard to pull it out without breaking something.