问题
I have an iframe inside ExtJS Ext.Window component. In the iframe, I make an ajax call to the php layer, which returns a pdf object and that gets rendered in the iframe. I need to set timeout in the js layer, say if the processing takes more than 1 second, I should abort the process. I saw about the various methods that iframe provides, but there is nothing relating to timeout. ontimeout is the closest function, but I am not clear where to set the timeout.
var win = new Ext.Window({
id: 'window',
width: 290,
height: 440,
shim: false,
hidden: true,
closeAction: 'destroy',
waitMsg: "fetching",
html: '<iframe style="width:100%; height:100%;" src="/index.php/abc/xyz?value=' + value + '"onload =" this.contentWindow.print();this.contentWindow.close();"/>'
});
win.show();
win.hide();
The above piece of code is present within a function which gets called whenever the value is entered in a text box and Enter key is pressed.
Can someone please tell me how to set the timeout in the JavaScript file?
来源:https://stackoverflow.com/questions/50285225/setting-time-out-in-iframe-inside-ext-window