Skip to content

createit-dev/166-how-to-click-programmatically-button-inside-iframe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

How to click programmatically button inside iframe?

There can be situations when we would like to customize iframe content or trigger some actions from outside iframe window.

Presented demos display how to make button that is outside iframe – clicking button placed inside iframe.

Example of clicking iframe button (from outside iframe):

<script>
    function triggerClickInsideIframe() {
        document.getElementById("myIframe").contentWindow.document.getElementById("toggleDivButton").click();
    }
</script>

Notice: iframe modifications are allowed only for same-origin urls (the same protocol and domain)

Demo1

Demo2

Demo3

Learn More

Learn more in the article: 'How to Trigger a Click Event Inside an Iframe?'

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages