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

embed dashboard iframe auto-height #14716

Closed
skerbis opened this issue Jul 31, 2019 · 10 comments · Fixed by #14724
Closed

embed dashboard iframe auto-height #14716

skerbis opened this issue Jul 31, 2019 · 10 comments · Fixed by #14724

Comments

@skerbis
Copy link
Contributor

skerbis commented Jul 31, 2019

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

@skerbis skerbis changed the title embed dashboard auto-height embed dashboard iframe auto-height Jul 31, 2019
@tsteur
Copy link
Member

tsteur commented Jul 31, 2019

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

@skerbis
Copy link
Contributor Author

skerbis commented Jul 31, 2019

Hi,sure:

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
Copy link
Member

tsteur commented Jul 31, 2019

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

@skerbis
Copy link
Contributor Author

skerbis commented Jul 31, 2019

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
Copy link
Member

tsteur commented Jul 31, 2019

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
Copy link
Contributor Author

skerbis commented Jul 31, 2019

I will investigate it tomorrow. Thx

@skerbis
Copy link
Contributor Author

skerbis commented Aug 1, 2019

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
Copy link
Member

tsteur commented Aug 2, 2019

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
Copy link
Contributor Author

skerbis commented Aug 2, 2019

Thanks ... PR will come :-)

@skerbis
Copy link
Contributor Author

skerbis commented Aug 2, 2019

Thanks Thomas @tsteur ;-)

tsteur pushed a commit that referenced this issue Aug 4, 2019
* Adding iFrameResizer.contentWindow.min.js

fixes: #14716

* Adding: iframeResizer.contentWindow.min.js

fixes:  #14716

* adding newest version of iframeResizer.min.js

* Mention iframe resizer in the legal notice

Was forgotten to be added there previously
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants