Forum > Third party
fpwebview - Free Pascal binding for webview
PierceNg:
Hi all,
I'm pleased to announce fpwebview, the Free Pascal binding for webview, the cross-platform library that links with gtk-webkit2 on Linux, Cocoa/WebKit on macOS and Edge on Windows 10 for building desktop web applications.
Supporting shared library, dylib, DLL and import library files for Linux, macOS and Windows for x86_64 are bundled.
Here's a simple Pascal program that uses fpwebview to implement a web browser.
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---program browser_cli; {$linklib libwebview} uses {$ifdef unix}cthreads,{$endif} math, webview; var w: PWebView; begin { Set math masks. libwebview throws at least one of these from somewhere deep inside. } SetExceptionMask([exInvalidOp, exDenormalized, exZeroDivide, exOverflow, exUnderflow, exPrecision]); writeln('Hello, webview, from Pascal!'); w := webview_create(WebView_DevTools, nil); webview_set_size(w, 1024, 768, WebView_Hint_None); webview_set_title(w, PAnsiChar('WebView Free Pascal')); webview_navigate(w, PAnsiChar('https://www.freepascal.org/')); webview_run(w); webview_destroy(w); writeln('Goodbye, webview.');end.
alaa123456789:
hi , it is nice to see this big development for lazarus as it was lacking this power , but we try it didnt work could you please see why, or use in windows application
thanks for your efforts
Thaddy:
This definitely needs some work: C style pointers? PWebView? Certainly that can be done better.
But it is great effort.
PierceNg:
--- Quote from: alaa123456789 on February 14, 2022, 06:45:22 pm ---hi , it is nice to see this big development for lazarus as it was lacking this power , but we try it didnt work could you please see why, or use in windows application
thanks for your efforts
--- End quote ---
Hi. Assuming you are on Windows, did 'winbuild.bat' fail? That batch file will fail if it cannot invoke fpc.exe to build the program. The location of fpc.exe is set in the %fpcexe% variable in the batch file.
If the failure is something else, please provide more details.
PierceNg:
--- Quote from: Thaddy on February 14, 2022, 06:52:04 pm ---This definitely needs some work: C style pointers? PWebView? Certainly that can be done better.
But it is great effort.
--- End quote ---
Thanks. For now I am focused on working out bidirectional Pascal-Javascript calls for serverless web app using webview's API or websockets. With more experience using the APIs, a TWebView class wrapping those C-style functions and pointers will come.
Navigation
[0] Message Index
[#] Next page