Webview question
Re: Webview question
I think with webview2, it is now possible to develop a single user interface for both the web and the desktop . Simply by replacing the function 'SendToFWH' with an AJAX call, one can change the access: either web browser or webview2.
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
Re: Webview question
Code: Select all | Expand
I think with webview2, it is now possible to develop a single user interface for both the web and the desktop . Simply by replacing the function 'SendToFWH' with an AJAX call, one can change the access: either web browser or webview2.
Si correcto comparto tu idea, creo que se pueden hacer muchas cosas de buena calidad visual con esta clase y sin servidor web . Lo que nos toca es empezar. jejejejeje
Saludos
LEANDRO AREVALO
Bogotá (Colombia)
https://hymlyma.com
https://hymplus.com/
leandroalfonso111@gmail.com
leandroalfonso111@hotmail.com
[ Embarcadero C++ 7.60 for Win32 ] [ FiveWin 23.07 ] [ xHarbour 1.3.0 Intl. (SimpLex) (Build 20230914) ]
LEANDRO AREVALO
Bogotá (Colombia)
https://hymlyma.com
https://hymplus.com/
leandroalfonso111@gmail.com
leandroalfonso111@hotmail.com
[ Embarcadero C++ 7.60 for Win32 ] [ FiveWin 23.07 ] [ xHarbour 1.3.0 Intl. (SimpLex) (Build 20230914) ]
Re: Webview question
Leandro,
I'm already in the middle of it.
Best regards,
Otto
I'm already in the middle of it.
Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
Re: Webview question
Is it posible to insert a value to an input using oWebView:InjectJavascript()?
I tried with no success.
I tried with no success.
Code: Select all | Expand
#include "FiveWin.ch"
static oWebView
function Main()
local oWnd
DEFINE WINDOW oWnd TITLE "Consulta de Comprobantes"
oWnd:Center()
oWebView = TWebView():New(, oWnd:hWnd )
oWebView:Navigate( "https://e-consulta.sunat.gob.pe/ol-ti-itconsvalicpe/ConsValiCpe.htm" )
oWebView:InjectJavascript( SetScript() )
oWebView:SetUserAgent( "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.53 Mobile Safari/537.36" )
ACTIVATE WINDOW oWnd CENTER ;
ON RESIZE If( nWidth != nil, oWebView:SetSize( nWidth, nHeight ), oWebView:SetSize( 1000, 700 ) )
oWebView:Destroy()
return nil
function SetScript()
local cHtml
TEXT INTO cHtml
<script>
document.getElementById('num_ruc').value = '0123456789' ;
</script>
ENDTEXT
return cHtml
Ralph del Castillo
Lima PERU
Fwh 24.07, xHb123_10193, MySQL 5.5, BCC 7.3
Lima PERU
Fwh 24.07, xHb123_10193, MySQL 5.5, BCC 7.3
- Antonio Linares
- Site Admin
- Posts: 42259
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Webview question
Dear Ralph,
After injecting the code you have to call it:
oWebView:Eval( "MyScript()" )
but first you need to implement such function in javascript:
After injecting the code you have to call it:
oWebView:Eval( "MyScript()" )
but first you need to implement such function in javascript:
Code: Select all | Expand
function SetScript()
local cHtml
TEXT INTO cHtml
<script>
function MyScript() {
document.getElementById('num_ruc').value = '0123456789' ; }
</script>
ENDTEXT
return cHtml
Re: Webview question
I tested this sample successfully. May be this can help someone:
Unfortunally, i can not make it work with this public page:
The page contains elements with the same name.
Maybe, i think, the google-recaptcha it contains is avoiding javascript injection.
If someone can help, welcome!
Code: Select all | Expand
#include "FiveWin.ch"
static oWebView
function Main()
local oWnd, cFile
DEFINE WINDOW oWnd TITLE "Consulta de Comprobantes" MENU BuildMenu()
oWnd:Center()
oWebView = TWebView():New(1, oWnd:hWnd )
oWebView:Navigate( "https://myefacts.com/test/")
oWebView:SetSize( 1000, 700 )
oWebView:SetUserAgent( "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.53 Mobile Safari/537.36" )
oWebView:Bind( "SendToFWH" )
oWebView:bOnBind = { | cJson, cCalls | cFile:="c:\temp\respuesta.json" , StrFile( cJson, cFile), alert(cFile) }
Sleep( 400 )
oWebView:InjectJavascript( SetScript() )
oWebView:Eval( "MyScript()" )
ACTIVATE WINDOW oWnd CENTER ;
oWebView:Destroy()
return nil
function BuildMenu()
local oMenu
MENU oMenu
MENUITEM "Source." ACTION oWebView:Eval( "SendToFWH( document.body.outerHTML )" )
MENUITEM "Load ." ACTION (oWebView:Eval( "MyScript()" ), oWebView:Eval( "alert( 'asignado '+document.getElementById('num_ruc').value )" ) )
MENUITEM "About ." ACTION MsgAbout()
ENDMENU
return oMenu
//---------------------
function SetScript()
local cHtml
TEXT INTO cHtml
function MyScript() {
document.getElementById("num_ruc").value = '20123456781' ;
}
ENDTEXT
return cHtml
Code: Select all | Expand
oWebView:Navigate( "https://e-consulta.sunat.gob.pe/ol-ti-itconsvalicpe/ConsValiCpe.htm" )
....
Maybe, i think, the google-recaptcha it contains is avoiding javascript injection.
If someone can help, welcome!
Ralph del Castillo
Lima PERU
Fwh 24.07, xHb123_10193, MySQL 5.5, BCC 7.3
Lima PERU
Fwh 24.07, xHb123_10193, MySQL 5.5, BCC 7.3
Re: Webview question
Hello
I ask does it run PHP and JQuery without a server
not tested
I ask does it run PHP and JQuery without a server
not tested
Thanks,
Ari
FWH 2212 - Harbour 3.2.0 - Embarcadero 7.43 - MySQL
São Paulo - SP - Brasil
www.sisrev.com.br
Ari
FWH 2212 - Harbour 3.2.0 - Embarcadero 7.43 - MySQL
São Paulo - SP - Brasil
www.sisrev.com.br