Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Two iframes on the same page, only on target runs the getPageInfo #562

Closed
lukashanssondn opened this issue Feb 16, 2018 · 7 comments
Closed
Labels

Comments

@lukashanssondn
Copy link

I have a simple page with two iframes that I init with iFrameResize.

The sizing works fine on both iframes but only one iframe recives the info of the parent page thru the method parentWindow.getPageInfo

The readyCallback: runs on both iframes
but the metod parentWindow.getPageInfo runs only on the first iframe page to be initalized.

Is this a bug or em I doning something wrong?

@davidjbradshaw
Copy link
Owner

I've no idea and would need a simple test case before I could understand the issue.

@lukashanssondn
Copy link
Author

lukashanssondn commented Feb 16, 2018

Hi David thanks for you fast response
Check out this demo
Only the method getPageInfo in index_f1.html will write to the console when scrolling in iframe.html
test.zip

and thanks for a greate library anyway we use it a lot

@lukashanssondn lukashanssondn changed the title Two ifarmes on the same page only on tagert runs the getPageInfo Two iframes on the same page, only on target runs the getPageInfo Feb 16, 2018
@thomaspringle
Copy link

thomaspringle commented Feb 22, 2018

@lukashanssondn I have this same issue and it has to do with the debounce of the getPageInfo function.
See #405 as well.

You can verify this by modifying iframeResizer.js as follows:

function sendPageInfoToIframe(iframe,iframeId){
			// function debouncedTrigger(){
				trigger(
					'Send Page Info',
					'pageInfo:' + getPageInfo(),
					iframe,
					iframeId
				);
			// }

			// debouce(debouncedTrigger,32);
		}

@lukashanssondn
Copy link
Author

Thanks Thomas this gave me the hope back to have this work :-)

@davidjbradshaw
Copy link
Owner

Do you want to make a PR for that?

@thomaspringle
Copy link

@davidjbradshaw Yes, I would like to remove the debounce from sendPageInfoToIframe() and move it to startPageInfoMonitor() so it wraps the for-loop instead. So that the messages get sent to all frames or get debounced:

        function debouncedMessageSender() {
          ['scroll','resize'].forEach(function(evt) {
            log(id, type +  evt + ' listener for sendPageInfo');
            func(window,evt,sendPageInfo);
          });
        }
        
        debouce(debouncedMessageSender,32);   

Does that sound OK?

thomaspringle pushed a commit to thomaspringle/iframe-resizer that referenced this issue Feb 23, 2018
thomaspringle pushed a commit to thomaspringle/iframe-resizer that referenced this issue Feb 23, 2018
thomaspringle pushed a commit to thomaspringle/iframe-resizer that referenced this issue Feb 27, 2018
thomaspringle pushed a commit to thomaspringle/iframe-resizer that referenced this issue Feb 27, 2018
thomaspringle pushed a commit to thomaspringle/iframe-resizer that referenced this issue Feb 27, 2018
@davidjbradshaw
Copy link
Owner

Fixed in v3.6.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants