@skerbis opened this Issue on July 31st 2019 Contributor

is this possible?
Is there a way to do this?

@tsteur commented on July 31st 2019 Member

@skerbis not sure what you mean? Can you describe this in more details?

@skerbis commented on July 31st 2019 Contributor


i embed the dashboard to our system by using the code like this:

        <iframe src="https://domain.tld/piwik/index.php?module=Widgetize&action=iframe&moduleToWidgetize=Dashboard&actionToWidgetize=index&idSite=7&period=week&date=yesterday&token_auth=00000000000000
" frameborder="0" marginheight="0" marginwidth="0" width="100%" style="height: 100vh"></iframe>

Is there a Way (a JS-Code) to auto resize the embedded iframe so that it fits to the body of it?
I would like avoid scrollbars.

Perhaps something like: https://github.com/davidjbradshaw/iframe-resizer

Is a solution perhaps included in Matomo?
It's for a CMS AddOn so I cannot say the users to manipulate matomo for it.

@tsteur commented on July 31st 2019 Member

We have the iframe-resizer embedded in Matomo and AFIAK load it on every request. You could try if it just works

@skerbis commented on July 31st 2019 Contributor

do you have an example code

iFrameResize({ log: true }, '#matomoframe')

does not work.
I've installed the frame-resizer and gave the iframe the id #matomoframe

@tsteur commented on July 31st 2019 Member

Sorry I don't really have the time to investigate much here right now. I can see though that iFrameResize is being loaded in the widgetized iframe if you use the latest Matomo version.
Do you get any error? Is it on the same domain or so?

@skerbis commented on July 31st 2019 Contributor

I will investigate it tomorrow. Thx

@skerbis commented on August 1st 2019 Contributor

I get the following Error:

[iFrameSizer][Host page: matomoframe] – "IFrame has not responded within 5 seconds. Check iFrameResizer.contentWindow.js has been loaded in iFrame. This message can be ignored I…"

Matomo-Version: 3.11.0

@tsteur commented on August 2nd 2019 Member

Just tested it. I didn't get an error but noticed it isn't working because the widget that you embed would also need to load https://raw.githubusercontent.com/davidjbradshaw/iframe-resizer/master/js/iframeResizer.contentWindow.min.js

Then it works... Did you maybe want to create a PR? We could place the file in this directory where we already have the other iframeResize file: https://github.com/matomo-org/matomo/tree/3.x-dev/plugins/CoreHome/javascripts

and we would load the file here: https://github.com/matomo-org/matomo/blob/3.12.0-b1/plugins/CoreHome/CoreHome.php#L305

@skerbis commented on August 2nd 2019 Contributor

Thanks ... PR will come :-)

@skerbis commented on August 2nd 2019 Contributor

Thanks Thomas @tsteur ;-)

This Issue was closed on August 4th 2019
Powered by GitHub Issue Mirror