Skip to content

Conversation

@RicardoTM05
Copy link
Contributor

@RicardoTM05 RicardoTM05 commented Dec 21, 2025

This update contains the following:

New Measure Number Values
The measure's number value now represents the state of WebView2 before any navigation, and the state of the navigation afterwards. The following numbers apply:

  • WebView failed: -2
  • WebView not running: -1
  • WebView Initializing: 0
  • WebView Initialized: 1
  • Navigation Start: 100
  • Loading Site: 200
  • DOM Content loaded: 300
  • Navigation Complete: 400

New Measure String Value

  • Current URL
    Now the measure will return the current url whenever is available.
    Example: https://www.forum.rainmeter.net/

New Actions
To reflect states, we also have new actions.

  • OnWebViewStopAction
    Triggers when WebView stops successfully.
  • OnStateChangeAction
    Triggers every time the state changes
  • OnUrlChangeAction
    Triggers every time the URL changes
  • OnPageDOMLoadAction
    Trigger when the DOM content finishes loading, it triggers before OnPageLoadFinishAction.

New Commands
As a part of the new lifecycle system, we can now start and stop WebView by using the following commands.

  • Stop
    Stops any navigation.
  • GoHome
    Navigates to the URL set on the measure's URL option.
  • WebViewStart
    Starts WebView manually if not running.
  • WebViewStop
    Stops WebView manually if running.
  • WebViewRestart
    Restarts WebView manually if running.

New Options

  • AllowNewWindow default: 0
    When enabled, the user will be able to open new windows, while disabled all navigations will happen on the main window.
  • AllowNotifications default: 0
    WebView doesn't allow to use the Notifications API by default, now we can use it by setting this option to 1.
    AutoStart defalut: 1
    When disabled, WebView will not start automatically when the skin loads.

Other Changes

  • window.OnInitialize and window.OnUpdate no longer change the measure’s string nor number values.
  • The URL option on the measure now works as a Home Page URL and is the URL to which WebView will navigate after starting. To navigate somewhere else you now have to use the Navigate command. To navigate back to the home page set on the URL option you now use the GoHome command. In other words, updating the URL option will not navigate to it, it will only set the new URL as the Home Page.
  • Now ExecuteScript will inject to the main document and all available top-level iframes when possible.
  • Now websites won't be able to trigger undesired pop-up windows.
  • Disabling the measure will now disable all commands from triggering, and all options from updating until the measure is enabled. Navigation is not affected while the measure is disabled.
  • It is now possible to frame websites, but this requires the use of a http-server. This works by bypassing X-Frame-Options and injecting our own "frame ancestor", which would be the current base URL that is trying to frame, e.g. http://localhost:port/. More information on how to use a http-server here.

Bug Fixes

  • Fixed a minor bug when dragging the webview window.

Known Issues

  • Dragging from an iframe will sometimes move the window on unexpected ways. (Should be fixed before merging, hopefully)
  • RainmeterAPI is not available in some websites.

@RicardoTM05 RicardoTM05 marked this pull request as ready for review December 21, 2025 06:14
@RicardoTM05 RicardoTM05 marked this pull request as draft December 21, 2025 19:16
Turned off put_AllowHostInputProcessing due to it messing with AllowDualControl. Should be turned on once we start implementing a Non-JS AllowDualControl version.
@RicardoTM05 RicardoTM05 marked this pull request as ready for review December 21, 2025 19:25
@NSTechBytes
Copy link
Owner

Thank you for the PR. I will test it and merge it after I return home.

@NSTechBytes NSTechBytes self-requested a review December 22, 2025 05:51
@NSTechBytes
Copy link
Owner

RicardoTM, could you please publish the compiled DLL with the changes?

@RicardoTM05 RicardoTM05 mentioned this pull request Dec 22, 2025
@RicardoTM05
Copy link
Contributor Author

RicardoTM, could you please publish the compiled DLL with the changes?

Sure, you'll find it here

@Yincognyto
Copy link

Yincognyto commented Dec 22, 2025

I'm ok with the direction (values, actions, commands, options) this is going (looks like CallJS will be the only way to return a value from the plugin, which is fine with me - we'll see if and what can be done on the sync issue). A bit crowded now with stuff, but each thing is useful in some way.

That being said, this crashes Rainmeter on skin refresh every time for me, so, unless there is some mistake in my code (doubt it, since all I do is refresh the skin and whatever stuff ahead of this version should be invalid and gracefully be ignored), it needs to be redone / fixed in that regard. By the way, Ricardo, the test builds corresponding to this (with roughly the same changes) that you sent me were fine and not experiencing these issues, only this one you posted now.

Here is the code I'm using, for reference - it includes some of my tests, but they don't matter to this, just the .ini file:
BangCommand.zip
For the record, I initially loaded this along with my skin suite when starting Rainmeter, but the crash on refresh happens every time, regardless of having any other skin loaded. So, it's definitely something wrong with this particular build / .dll file.

@RicardoTM05
Copy link
Contributor Author

Oh yeah, I had fixed that before but forgot to do it for this branch. I’ll update it when I get on the PC. Thanks for letting me know.

RicardoTM05 and others added 2 commits December 22, 2025 12:04
…to false

Turned off put_AllowHostInputProcessing due to it messing with AllowDualControl. Should be turned on once we start implementing a Non-JS AllowDualControl version. Stop WebView on Finalize to avoid crashes.
@RicardoTM05
Copy link
Contributor Author

Crash is fixed, updated the file on #9 (comment). Please test

@RicardoTM05 RicardoTM05 marked this pull request as draft December 23, 2025 00:47
@RicardoTM05
Copy link
Contributor Author

RicardoTM05 commented Dec 23, 2025

Just an update, I've found how to inject nested frames. I will commit again after I get it properly tested and make sure everything works fine.

Edit:
Ready. Updated the file on the same post mentioned above.

Now we are just waiting for @Yincognyto to finish his fix for AllowDualControl's misalign and if possible for YouTube and this will be ready to be merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants