add javascript to content inside iframe
Submitted by jukka79 on Mon, 08/20/2018 - 03:14
Forums:
Hi,
I have a drupal 7 site where I use h5p module.
How could I add external js file inside the iframe where the interactive content is (question set)?
I have managed to modify the embed.php file, and that works when the interactive content is embedded manually to a page.
But I think the embed.php file is not used when the h5p content is shown normally on a interactive content page.
Is there a file like embed.php which to modify to add a javascript?
The script which I need to add in the iframe is google analytics tracking script.
Thank you for a great module.
otacke
Tue, 08/28/2018 - 09:27
Permalink
Hi Jukka79!Scripts can be
Hi Jukka79!
Scripts can be added in h5p.js. You're modifying the core of H5P here, so I hope you are sure what you're doing.
Cheers,
Oliver
nvcacademy
Thu, 02/28/2019 - 22:30
Permalink
Javascript inside frame to disable right-click context menu
I've been trying to disable the right-click context menu in the audio player. I added this code to the end of h5p.js:
jQuery(document).ready(function(){
jQuery(function() {
jQuery(this).bind("contextmenu", function(event) {
event.preventDefault();
alert('Right click disable in this site!!')
});
});
});
I've verified this code works-- everywhere in the frame except in the audio player. I did test it elsewhere successfully.
I also tried adding oncontextmenu="return false;" to the audio tag in debug mode as below. that works but I don't see how to change that in h5p
<audio class="h5p-audio" controls="" preload="auto" style="display: block; width: 100%;" oncontextmenu="return false;"><source src="pathto.mp3" type="audio/mp3"></audio>
Any thoughts how to get there form here? thanks.
smartlearn
Wed, 05/06/2020 - 21:03
Permalink
whre to add this code exactly ?
i have h5p plugin in moodle
i want to disalble right click on interactive video
i found the file h5p.js and can edit it , but where to add this code please
akmiecik
Wed, 10/07/2020 - 15:23
Permalink
where?
where?
nvcacademy
Wed, 10/07/2020 - 17:25
Permalink
where where where
I noted in my post abopve exactly where
"I added this code to the end of h5p.js:"
the end means the end. the very end after everything else.
otacke
Thu, 10/08/2020 - 14:47
Permalink
:-D
:-D
nvcacademy
Wed, 10/07/2020 - 17:24
Permalink
where where where
I noted in my post abopve exactly where
"I added this code to the end of h5p.js:"
the end means the end. the very end after everything else.
nvcacademy
Wed, 03/04/2020 - 22:37
Permalink
found a solution dependent upon a code change
Currently, the h5p audio player has a settings option to disable downloads. It doesn't work because the h5p audio player uses the native browser html5 audio player for playback. This could be fairly easily remedied. Add some code to the h5p audio content type that when "Allow Download" under "Display Options " in the settings is unchecked and saverd, then these parameters are added to the audio player
oncontextmenu="return false;"
and
controls controlsList="nodownload"
for example:
<audio width="640" controls controlsList="nodownload" oncontextmenu="return false;"> <source data-src="talktalk.mp3" type="audio/mp3"></audio>
I have tested this and it does work, just needs to be implemented. Looking for a h5p developer to take this on. I'm sure it would serve many people want to block downloads directly from the page displayed. (Yes, I know people can still scour the source and find the URL)
thanks