Back button iframe history back problem


#1

I have one iframe in page.

If android device press back button, I want to iframe history go back.

But now, app exit.

How do I fix my Code?

Below is my Code.

------ in html

iframe id is “myframe”

------- in ts

constructor(public navCtrl: NavController) {

console.log("ready");
document.addEventListener("backbutton", () => {
  
  console.log("click");
  // 
  var iframe = document.getElementById('myframe');
  iframe['contentWindow'].history.back();   //doesn't work
  iframe.contentWindow.history.back();  //compile error

}, false);

}