I am developing an application with ionic and I need to capture an information that exists in an external web page, I have tried to embed the web with a <iframe>
tag and I try to select the html
element that contains the data but I can not do it, the information that I need to obtain is what is highlighted in red:
What I have tried is the following:
Html:
<ion-header>
<ion-navbar>
<ion-title>
Home
</ion-title>
</ion-navbar>
</ion-header>
<ion-content >
<iframe class="iframe" src="http://www.flalottery.com/fantasy5"></iframe>
</ion-content>
ts:
import { Component, ViewChild } from '@angular/core';
import { NavController } from 'ionic-angular';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
@ViewChild('gameContentLeft') sorteo;
constructor(public navCtrl: NavController) {
}
ionViewDidLoad() {
var sorteo = document.getElementById('gameContentLeft')
console.log([sorteo, this.sorteo]);
console.log('ionViewDidLoad RegistroPage');
}
}
But everything gives me as undefined or null,
In what way can I extract this data from this page using JavaScript
?
Is there any other way to extract this data with ionic without using the <iframe>
tag?