Forum Discussion
How to trigger an iframe button in storyline course?
- 5 months ago
I was finally able to get a folder at the base of our website to try this and it still doesn't work. I went to the link you have above on my mobile phone to test your example and even yours doesn't show the actual file on a mobile phone it shows a link to download where your document should be...it works properly on a desktop but not on a mobile phone. Is there any script/coding to make a document show in an iframe on a mobile phone using the web object in storyline instead of showing a download button where the document should be showing like it does on a desktop. See below I want the actual document showing in that iframe not a download button.
.
I don't think you can do that. Due to browser security restrictions, when the parent page and the iframe come from different websites (cross-origin), you can't directly access the content inside the iframe. This is to protect user privacy and prevent malicious activity. If both the parent page and iframe are from the same website (same-origin), then access could be allowed with something like:
const iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
const button = iframeDocument.querySelector('#buttonId');
Can you share your index.html?
Related Content
- 7 months ago
- 10 months ago
- 10 months ago
- 10 years ago