reloadIframe function

Future<bool> reloadIframe(
  1. IFrameElement iFrame, [
  2. bool? forceGet
])

Reloads an IFrame document.

Implementation

Future<bool> reloadIframe(IFrameElement iFrame, [bool? forceGet]) async {
  var loaded = await addJavaScriptCode('''
    window.__dom_tools_reloadIFrame = function(iframe,forceGet) {
      iframe.contentWindow.location.reload(forceGet);
    }
  ''');

  if (!loaded) return false;

  forceGet ??= false;
  callJSFunction('__dom_tools_reloadIFrame', [iFrame, forceGet]);
  return true;
}