PHP “header (location)” inside IFRAME, to load in _top location?

前端 未结 8 1790
名媛妹妹
名媛妹妹 2020-12-03 10:20

I have a simple form which is inside IFRAME. When user click on SUBMIT, it redirects to a specific page on my server. The function I use for the redirect is



        
8条回答
  •  盖世英雄少女心
    2020-12-03 10:52

    You can use javascript to access the parent. You could echo out javascript in your PHP.. so your parent page has this:

    function changeURL( url ) {
        document.location = url;
    }
    

    and in your php script, you echo

    
    

    The reason you can't call parent.document.location is because it's read only - you have to have a function available on the parent to do it.

提交回复
热议问题