Buenas tardes.
Alguien que me pueda ayudar con un ejemplo sencillo que ejecute una función javascript desde un boton
utilizando TWebView
Muchas gracias.
Saludos
Oscar
Fwh 23.10, bcc55
Buenas tardes.
Alguien que me pueda ayudar con un ejemplo sencillo que ejecute una función javascript desde un boton
utilizando TWebView
Muchas gracias.
Saludos
Oscar
Fwh 23.10, bcc55
Leandro
Muchas gracias
Saludos
Oscar
Fwh 23.10, bcc55
Estimados buenas tardes
Estoy tratando de ejecutar la siguiente funcion javascript con TWebView pero no me funciona
//----------------------------------------------------------------------------//
function Main()
local oWebView := TWebView():New()
oWebView:Center()
oWebView:bOnBind = { | cJson, cCalls | MsgInfo( cJson, cCalls ),;
oWebView:Return( cCalls, 0, "{ 'result': 'Hello from PRG' }" ) }
oWebView:Bind( "SendToFWH" )
oWebView:Navigate( Html() )
Sleep( 200 )
oWebView:Run()
oWebView:Destroy()
return nil
//----------------------------------------------------------------------------//
function Html()
local cHtml
TEXT INTO cHtml
data:text/html,
<head><body>
<button id='btn-test' >Click Me</button>
<script>
function test(evt) {
var response = [];
var pwd_p12 = '12345'
respuesta = 'oscar'
window.contenido_comprobante = respuesta;
var oReq = new XMLHttpRequest();
// alert(oReq.readyState );
// alert(this.status );
var ruta_certificado = 'c:\archivo.p12';
oReq.open("GET",ruta_certificado , true);
// alert(oReq.readyState );
oReq.responseType = "arraybuffer";
oReq.send();
alert(oReq.readyState );
alert( oReq.response);
oReq.onload = function (oEvent) {
var blob = new Blob([oReq.response], {type: "application/x-pkcs12"});
window.contenido_p12 = [oReq.response];
console.log(window.contenido_p12)
}
// alert( oReq.status );
// alert( oReq.response );
}
document.getElementById('btn-test').addEventListener('click', test);
</script>
</head></body>
ENDTEXT
return cHtml
Al parecer esta funcion XMLHttpRequest() trabaja teniendo un servidor web no estoy seguro, quiza me puedan orientar a ver si se puede
o como lo podria hacer con fwh
Muchas gracias.
Saludos
Oscar
Fwh 23.10, bcc55
Efectivamente, necesitas un servidor Web que esté corriendo en tu máquina
Puedes probar a instalar Apache ( Xampp ) o simplemente el httpd de harbour
Use a local web server: Running a local web server allows you to serve your files over HTTP, which helps bypass the same-origin policy restrictions. There are several lightweight web servers available that you can install and run locally, such as Node.js with Express, Python's SimpleHTTPServer, or the Live Server extension for Visual Studio Code.
Disable web security in your browser: Another option is to disable web security in your browser temporarily for testing purposes. Keep in mind that this approach is not recommended for regular browsing due to security implications. In Chrome, you can start the browser with the --disable-web-security flag to disable the same-origin policy. However, exercise caution when using this method.
Use a browser extension: Some browser extensions, like CORS Unblock, allow you to bypass the same-origin policy by adding appropriate CORS headers to requests. These extensions modify the headers of the requests you make, enabling you to access resources from different domains.
Cristóbal , Antonio
Muchas gracias seguire investigando
Saludos
Saludos
Oscar
Fwh 23.10, bcc55