Calling a parent window function from an iframe

后端 未结 10 2383
悲&欢浪女
悲&欢浪女 2020-11-22 01:43

I want to call a parent window JavaScript function from an iframe.



&         


        
10条回答
  •  梦毁少年i
    2020-11-22 02:13

    I recently had to find out why this didn't work too.

    The javascript you want to call from the child iframe needs to be in the head of the parent. If it is in the body, the script is not available in the global scope.

    
        
    
    
        
    
    

    Hope this helps anyone that stumbles upon this issue again.

提交回复
热议问题