Sorry, I tested the main frame after exported, only in preview situation will get a correct MainFrameURL, otherwise I get "".
The solution might be failed, this iframe filter only could check if current frame is in iframe or not.
I will try to find another way to solve this issue.
The checking of iframe still works, and the redirection of main frame works well, too. But expression:MainFrameURL failed.