executeScript method
Executes JavaScript code in the iframe context.
Implementation
@override
Future<String?> executeScript(String script) async {
try {
// Note: Direct script execution in iframe is restricted by CORS policies
// This is a simplified implementation - in practice, postMessage would be used
// for secure cross-origin communication
if (_iframeElement != null && _iframeElement!.contentWindow != null) {
// We can't directly execute scripts due to security restrictions
return 'Script execution requested (subject to CORS restrictions)';
}
return 'No iframe or content window available';
} catch (e) {
return 'Error executing script: $e';
}
}