It is currently April 26th, 2024, 11:20 am

PluginWebView - Make skin using web technology

Share and get help with Plugins and Addons
User avatar
balala
Rainmeter Sage
Posts: 16172
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: PluginWebView - Make skin using web technology

Post by balala »

Yincognito wrote: December 22nd, 2022, 12:45 am Hmm... I still believe it's not the plugin at fault here, since it's just an implementation to make use of the WebView2 technology. My impression is that it's either WebView2 itself, or, like alluded earlier, some other dependency needed to have it all working. I experienced this type of "silent failure" in other cases as well (not related to this), and properly setting up other areas of the "Windows macrosystem" fixed things then. Nice job trying though! :thumbup:
Might be, don't know. Theoretically you're right. Anyway this is why the dev of the plugin would be needed here. Hoping sooner or later he'll tell us.
User avatar
Yincognito
Rainmeter Sage
Posts: 7170
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: PluginWebView - Make skin using web technology

Post by Yincognito »

balala wrote: December 22nd, 2022, 9:07 pm Might be, don't know. Theoretically you're right. Anyway this is why the dev of the plugin would be needed here. Hoping sooner or later he'll tell us.
True. Even so, very soon future versions of WebView2 runtime will cease to work with Win7 anyway, therefore such concerns will be less and less encountered... It would be great if platforms like this and others would work in all cases, but that's the way things evolve, with "updates" needed for everything in order to keep up with the times.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
Yincognito
Rainmeter Sage
Posts: 7170
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: PluginWebView - Make skin using web technology

Post by Yincognito »

If anyone wants to see how one can fully integrate Webview2 technology in Rainmeter so that the skin behaves at the same time like a webpage and a plain Rainmeter skin while producing a nice outcome, feel free to check my recently released 3D Earth skin.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
Robzyy
Posts: 1
Joined: February 2nd, 2024, 1:03 pm

Re: PluginWebView - Make skin using web technology

Post by Robzyy »

Hello everyone! I've decided to give this plugin a try but I've encountered an error. When trying to acess the RainmeterAPI from within JS I get an "Uncaught ReferenceError: RainmeterAPI is not defined" error. This even happens on the example skins. Has anyone encountered this?

Running Win11 23H2, so WebView comes preinstalled... maybe the plugin needs to be updated...
User avatar
Yincognito
Rainmeter Sage
Posts: 7170
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: PluginWebView - Make skin using web technology

Post by Yincognito »

Robzyy wrote: February 2nd, 2024, 1:07 pm Hello everyone! I've decided to give this plugin a try but I've encountered an error. When trying to acess the RainmeterAPI from within JS I get an "Uncaught ReferenceError: RainmeterAPI is not defined" error. This even happens on the example skins. Has anyone encountered this?

Running Win11 23H2, so WebView comes preinstalled... maybe the plugin needs to be updated...
I didn't encounter the issue, but then I'm still on my initial WebView version and on Win 10 (I won't switch to Win 11 anytime soon, if at all, though WebView being pre-installed there is one of the few great news about Win 11). The issue might be a plugin problem (posting it on the plugin's GitHub page too might help in that regard, though an answer or resolution isn't guaranteed since khanhas might be busy with other things), but might also be about making sure other dependencies in the background function correctly and are present (.NET Frameworks or some other Windows setting).

Sorry I can't help more with that, maybe someone with more knowledge on the said Windows version can offer some insight.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
arskvsh
Posts: 1
Joined: February 6th, 2024, 6:02 pm

Re: PluginWebView - Make skin using web technology

Post by arskvsh »

Robzyy wrote: February 2nd, 2024, 1:07 pm Hello everyone! I've decided to give this plugin a try but I've encountered an error. When trying to acess the RainmeterAPI from within JS I get an "Uncaught ReferenceError: RainmeterAPI is not defined" error. This even happens on the example skins. Has anyone encountered this?

Running Win11 23H2, so WebView comes preinstalled... maybe the plugin needs to be updated...
Does it work for you if you right-click on the webpage inside the skin (not the skin itself!) and press "Reload"?
I'm facing the same problem and this strange workaround helps me. However, the problem seems to be back each time I restart Rainmeter or reload the particular skin.

Apparently there's something wrong with the order of the API being connected to WebView instance as it can't be reached only on the first load. I tried to solve the problem with the least effort by rebuilding the plugin from its source code with updated WebView dependencies but haven't got any results. Probably need to dive deeply into the programming...
User avatar
Yincognito
Rainmeter Sage
Posts: 7170
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: PluginWebView - Make skin using web technology

Post by Yincognito »

Well, finally I got the Rainmeter API issue as well. Do any of you have the offline / standalone installation kit for either MS Edge version 100, or WebView Runtime version 109, so I could try downgrading? I do have older versions of both, but not versions that match between Edge and WebView (e.g. you can't install WebView if you have a higher version of Edge). And yes, I did look online for them, so something that you saved on your computer would be better, if you have it.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
Yincognito
Rainmeter Sage
Posts: 7170
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: PluginWebView - Make skin using web technology

Post by Yincognito »

Robzyy wrote: February 2nd, 2024, 1:07 pm Hello everyone! I've decided to give this plugin a try but I've encountered an error. When trying to acess the RainmeterAPI from within JS I get an "Uncaught ReferenceError: RainmeterAPI is not defined" error. This even happens on the example skins. Has anyone encountered this?

Running Win11 23H2, so WebView comes preinstalled... maybe the plugin needs to be updated...
arskvsh wrote: February 6th, 2024, 7:12 pmI'm facing the same problem and this strange workaround helps me. However, the problem seems to be back each time I restart Rainmeter or reload the particular skin.

Apparently there's something wrong with the order of the API being connected to WebView instance as it can't be reached only on the first load. I tried to solve the problem with the least effort by rebuilding the plugin from its source code with updated WebView dependencies but haven't got any results. Probably need to dive deeply into the programming...
As mentioned in my previous post, I was recently having the same RainmeterAPI issue as you did. I had to spend some time on it, since Microsoft is so helpful in making things hard for the user, but I eventually solved it by downgrading both Microsoft Edge AND Microsoft Edge WebView2 Runtime versions. I did it to the 100.0.1185.29 versions simply because I was cautious enough to save a copy of that WebView Runtime offline installer two years ago, and only needed to find a matching Edge version (which was difficult, but eventually done). Others can however do it to versions like 109.0.1518.78, since this is the last WebView version working on Windows 7 according to Microsoft. So, I wrote a step by step downgrading guide below.

PROBLEMS : WebView plugin for Rainmeter compatibility issues with the installed WebView packages (page reload needed, RainmeterAPI unavailability)
SOLUTIONS: downgrade both Edge and WebView (e.g. to 100.0.1185.29, 109.0.1518.78, or other versions), or update the WebView plugin for Rainmeter
REINSTALL (works for any Edge or WebView versions that doesn't exhibit the above problem, but ideally the versions should match):
1) download the 109.0.1518.78 versions of the Edge and WebView installers / updates from:
- https://www.catalog.update.microsoft.com/Search.aspx?q=edge+stable
- https://www.catalog.update.microsoft.com/Search.aspx?q=edge-webview2
2) try to uninstall the existing Edge and WebView normally from one of these locations:
- Control Panel > Programs And Features
- Start > Settings > Apps
3) delete any "Edge..." and "Temp" folders from the "C:\Program Files (x86)\Microsoft" folder (skip files that cannot be deleted, if any)
4) run the Edge installer package in order to reinstall the Microsoft Edge browser
5) search for "Registry Editor" in the Start menu, select "Run As Administrator", and optionally back up the registry via the File > Export... menu
6) go to "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate\Clients", and delete the "{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}" folder
7) the WebView update package from the catalog link above cannot be directly run and shows an "Unknown Installation Error", so to install WebView:
- use 7Zip from https://www.7-zip.org to extract the "MicrosoftEdge_X64_109.0.1518.78.exe.{0D50BFEC-CD6A-4F9A-964C-C7416E3ACB10}" file from it
- rename the extracted file to "MicrosoftEdge_X64_109.0.1518.78.exe"
- use CMD or a batch file at that file's location, to run "MicrosoftEdge_X64_109.0.1518.78.exe --msedgewebview --user-level" and install WebView
- make sure WebView works (tested successfully on Windows 10 21H1 Build 19043.1202, though it should work on higher Windows 11 versions)

Notes:
1) After installing WebView like above, its installation size is not displayed in the program / app list (Modify or Uninstall work though)
2) Latest WebView versions at https://developer.microsoft.com/en-us/microsoft-edge/webview2/?form=MA13LH CAN NOT be uninstalled like at 2)
3) For the above to persist, the "C:\Program Files (x86)\Microsoft\EdgeUpdate\MicrosoftEdgeUpdate.exe" should be blocked in your firewall

References:
- https://learn.microsoft.com/en-us/answers/questions/1329053/how-to-fix-unknow-installation-error-while-install
- https://github.com/MicrosoftEdge/WebView2Feedback/issues/3464#issuecomment-1537964955
- https://answers.microsoft.com/en-us/windows/forum/all/this-software-already-installed-on-your-system/8131f546-8d4a-40a6-a5ac-27c0b224d28d
- https://github.com/MicrosoftEdge/WebView2Feedback/issues/3780#issuecomment-1718124541

Hopefully, this will be of some help for those experiencing the same issue with the Rainmeter API references when working with the WebView plugin.

P.S. By the way, just for reference to whatever other C++ developers (couch cough Brian cough) might tackle including WebView2 as a plugin for Rainmeter: https://github.com/MicrosoftEdge/WebView2Browser
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
Yincognito
Rainmeter Sage
Posts: 7170
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: PluginWebView - Make skin using web technology

Post by Yincognito »

balala wrote: December 17th, 2022, 9:01 pm Interesting things, good to be known. Thanks for the details. My question is if this plugin can parse sites using Javascripts? Because as we know, the WebParser measures don't deal with these scripts, so if this plugin does, it's something fenomenal.
Yincognito wrote: December 17th, 2022, 9:44 pm Hmm... I didn't thought of that, to be honest - but it's an excellent question.

While technically you can indeed parse a webpage using an XMLHttpRequest in Javascript (and the result will include the outcome of whatever Javascripts on the page you query), in practice you'd have some "complications" along the way, like doing it for different web domains (which would need a server side script, as far as I know, or other ways to bypass CORS) and so on. I actually do something quite similar in the Javascript of my (unreleased / private) Chrome extension, where I'm web scraping for images instead, but then running as a Chrome extension has a couple advantages compared to a "normal" webpage, so things might not be precisely the same. I didn't try to do it from a WebView2 featured Rainmeter skin... yet.

It's something that's worth investigating though... :???:

P.S. I'm pretty sure that WebParser doesn't do this not because it couldn't, but because of security concerns. This is also something to consider when attempting that. ;-)
And here's a way to implement this. Don't know about the Javascripts on the address you query, but you can test this, of course. ;-)
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
Kotofanchik
Posts: 95
Joined: March 15th, 2024, 7:30 pm

Re: PluginWebView - Make skin using web technology

Post by Kotofanchik »

It doesn't read the word 'en' itself, I have to click on the red dot and click refresh in webweiv2
I couldn’t downgrade webwiev either, I couldn’t find Microsoft Edge WebView2 Runtime to the 100.0.1185.29 at all, I couldn’t install a slightly newer one, it says the computer doesn’t meet the minimum requirements. I deleted both edge and WebView2 with the batch file I found. I had to return the latest versions, they were installed, and webwiev2 was only able to install using the offline installer. web installer reported an error