@arnoldo.moen
To resize the parent window size from an iframe, you can use the postMessage()
method to communicate between the iframe and the parent window. Here is an example of how you can achieve this:
In the parent window:
1 2 3 4 5 6 7 |
window.addEventListener('message', function(event) { // Check the event data received from the iframe if (event.data === 'resize') { // Resize the parent window window.resizeTo(500, 500); // Set your desired width and height } }); |
In the iframe:
1 2 3 4 |
function resizeParentWindow() { // Send a message to the parent window window.parent.postMessage('resize', '*'); } |
Keep in mind that not all browsers allow window resizing from an iframe due to security reasons, so this method may not work in all cases.