Pēteris Caune
Pēteris Caune

Reputation: 45172

How to prevent iframe from resizing parent window?

I have a page with iframe. Content inside iframe does window.parent.resizeTo calls (or something similar that in result resizes whole browser window). It does so to accommodate for its contents. I want to prevent resizing of whole browser window and just change the size of iframe element instead.

Is there a way to intercept these resize commands in Javascript? I tried listening to parent's "resize" events, but they seemed to happen post-factum, when the window is already resized.

Upvotes: 1

Views: 2577

Answers (1)

Greg
Greg

Reputation: 321776

You could make the function do nothing:

var windowResizeTo = window.resizeTo; // In case we want to put it back later
window.resizeTo = function() {};

Upvotes: 2

Related Questions