Chromium Edge WebGadget

Developed or developing a new product in PureBasic? Tell the world about it.
User avatar
JHPJHP
Addict
Addict
Posts: 1924
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Chromium Edge WebGadget

Post by JHPJHP »

Hi ricardo,
ricardo wrote:Should I download version 6?
Tested, works with PB 5.73 LTS (64).
ricardo wrote:javascript in enabled on Edge.
The Chromium Edge WebGadget does not rely on personal browser settings; a profile is created for each Gadget.
ricardo wrote:BUT if i open a normal EDGE browser, navigate to youtube.com and then enter into the url
My Edge browser won't accept pasting JavaScript into the address bar, AFAIK this is now standard and a good thing.

The problem you reported sounds more like an AV firewall issue blocking port 9222, but without more information I cannot help you.
Last edited by JHPJHP on Sat May 14, 2022 3:20 am, edited 3 times in total.

STATUS: Mostly Unavailable :: Downloads moved to My PureBasic Stuff; free executables, access key required for source code.
_________________
ricardo
Addict
Addict
Posts: 2337
Joined: Fri Apr 25, 2003 7:06 pm
Location: Argentina

Re: Chromium Edge WebGadget

Post by ricardo »

Hi,

Yes JHPJHP, its your AV.


Very simple, but demonstrative, example on WebGadget. Try something like this in your Edge Webgadget

Code: Select all

JavascriptCode$ = "javascript:(function(){abc='hello World';alert(abc);document.body.style.backgroundColor = 'red';})();"

If OpenWindow(0, 0, 0, 600, 300, "WebGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  WebGadget(0, 10, 10, 580, 280, JavascriptCode$)
    
    Repeat
    Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf

I really dont know why your Javascript examples does not run in my computer.
If get it to work, many things could be done like it was on the past in normal webgadget using javascript.
ricardo
Addict
Addict
Posts: 2337
Joined: Fri Apr 25, 2003 7:06 pm
Location: Argentina

Re: Chromium Edge WebGadget

Post by ricardo »

This really simple example, but with another step (push the button please), show the whole possibilities. Because all the javascript we add remains and can be called again.

I use this possibility for years with PB to create very nice things.

Code: Select all

JavascriptCode$ = "javascript:(function(){abc='hello World';alert(abc);document.body.style.backgroundColor = 'red';})();"
AnotherJS$ = "javascript:alert(abc + ' again');"

If OpenWindow(0, 0, 0, 600, 300, "WebGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  WebGadget(0, 10, 10, 500, 280, JavascriptCode$)
  ButtonGadget(1,515,20,50,25,"")
    
    Repeat
      Event = WaitWindowEvent()
      Select Event
          Case #PB_Event_Gadget
            Select EventGadget()
              Case 1
                SetGadgetText(0,AnotherJS$)
            EndSelect
            
      EndSelect
      
    Until Event = #PB_Event_CloseWindow
EndIf
User avatar
JHPJHP
Addict
Addict
Posts: 1924
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Chromium Edge WebGadget

Post by JHPJHP »

Hi ricardo,

I think we're having a language issue. I was commenting on the problem you reported about running the new examples.
- I amended my previous post to be clearer, I can see how it might have been confusing

Your AV may be blocking port 9222, required to access DevTools; all of CEWG v2 is based on DevTools.

Some how the conversation got sidetracked to JavaScript from the address bar and the PureBasic WebGadget.

If you figure out what is causing the problem please post your results, but for now I'm taking a short break from programming.

STATUS: Mostly Unavailable :: Downloads moved to My PureBasic Stuff; free executables, access key required for source code.
_________________
ricardo
Addict
Addict
Posts: 2337
Joined: Fri Apr 25, 2003 7:06 pm
Location: Argentina

Re: Chromium Edge WebGadget

Post by ricardo »

Rather I think my mind was blown by the possibility of using javascript again with PB and I tried to show that, even though for some reason I couldn't get the example to run on my computer, if I used the address bar, that javascript example , it did work if I ran javascript from that address bar.

And from there I kept flying trying to show that even the javascript inserted from the address bar had the fabulous possibility of being integrated into the web page and being called later.

Anyway, I apologize for my enthusiasm. It was just that, I am like that, I get excited and I keep dreaming and dreaming. Because with Purebasic, in the past, every time I dreamed, I managed to make my dreams come true... and now I feel like I'm starting to dream again...
User avatar
JHPJHP
Addict
Addict
Posts: 1924
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Chromium Edge WebGadget

Post by JHPJHP »

Hi ricardo,

There have been some additional updates to try and narrow down the problem you're experiencing; please download the latest version.

1. Run the example CE_WebGadget_Remote_Detail.pb.
2. Post back to this thread the contents located in the window to the right; should look like the following.
}, {
"description": "",
"devtoolsFrontendUrl": "/devtools/inspector.html?ws=127.0.0.1:9222/devtools/page/7EC5D9D6BB8E99A09AF497965AD48495",
"faviconUrl": "https://www.youtube.com/favicon.ico",
"id": "7EC5D9D6BB8E99A09AF497965AD48495",
"title": "YouTube",
"type": "page",
"url": "https://www.youtube.com/",
"webSocketDebuggerUrl": "ws://127.0.0.1:9222/devtools/page/7EC5D9D6BB8E99A09AF497965AD48495"
}, {
3. If so, select the Socket Connection option; the StringGadget next to it should populate.
-- a) Change the Params text from depth:0 to depth:-1 and press the Socket button.
-- b) In the window to the right you should see the message: The connection has been opened successfully.
-- c) Wait a short while for the window to the right to be populated with a lot of (JSON) data.
4. If not, run the example CE_WebGadget_Remote_Basic.pb, it uses an alternate Port (part of the recent updates).

---------------------------------------

Updated
- added the Constant #CE_WebGadget_Connection_Port_Override
- renamed CE_WebGadget_Remote_Connect.pb to CE_WebGadget_Remote_Detail.pb
- removed some redundant code
- various improvements

STATUS: Mostly Unavailable :: Downloads moved to My PureBasic Stuff; free executables, access key required for source code.
_________________
ricardo
Addict
Addict
Posts: 2337
Joined: Fri Apr 25, 2003 7:06 pm
Location: Argentina

Re: Chromium Edge WebGadget

Post by ricardo »

Code: Select all

[ {
   "description": "",
   "devtoolsFrontendUrl": "/devtools/inspector.html?ws=127.0.0.1:9222/devtools/page/BB4CD51056992D942C36A75B7DC4DC0D",
   "faviconUrl": "https://www.youtube.com/favicon.ico",
   "id": "BB4CD51056992D942C36A75B7DC4DC0D",
   "title": "YouTube",
   "type": "page",
   "url": "https://www.youtube.com/",
   "webSocketDebuggerUrl": "ws://127.0.0.1:9222/devtools/page/BB4CD51056992D942C36A75B7DC4DC0D"
}, {
   "description": "",
   "devtoolsFrontendUrl": "/devtools/inspector.html?ws=127.0.0.1:9222/devtools/page/45B7AEB72891B55E96464CF830440AAE",
   "faviconUrl": "https://www.youtube.com/favicon.ico",
   "id": "45B7AEB72891B55E96464CF830440AAE",
   "parentId": "BB4CD51056992D942C36A75B7DC4DC0D",
   "title": "https://accounts.google.com/ServiceLogin?service=youtube&uilel=3&passive=true&continue=https%3A%2F%2Fwww.youtube.com%2Fsignin%3Faction_handle_signin%3Dtrue%26app%3Ddesktop%26hl%3Des-419%26next%3D%252Fsignin_passive%26feature%3Dpassive&hl=es-419",
   "type": "iframe",
   "url": "https://accounts.google.com/ServiceLogin?service=youtube&uilel=3&passive=true&continue=https%3A%2F%2Fwww.youtube.com%2Fsignin%3Faction_handle_signin%3Dtrue%26app%3Ddesktop%26hl%3Des-419%26next%3D%252Fsignin_passive%26feature%3Dpassive&hl=es-419",
   "webSocketDebuggerUrl": "ws://127.0.0.1:9222/devtools/page/45B7AEB72891B55E96464CF830440AAE"
}, {
   "description": "",
   "devtoolsFrontendUrl": "/devtools/inspector.html?ws=127.0.0.1:9222/devtools/page/E181EBA9FB0097347601A9A3B4640E42",
   "id": "E181EBA9FB0097347601A9A3B4640E42",
   "title": "Service Worker https://www.youtube.com/sw.js",
   "type": "service_worker",
   "url": "https://www.youtube.com/sw.js",
   "webSocketDebuggerUrl": "ws://127.0.0.1:9222/devtools/page/E181EBA9FB0097347601A9A3B4640E42"
} ]

The socket button is the "execute script"? Or jus enter? I did both and nothing. After a while a void msgbox shows.


Then i run "CE_WebGadget_Remote_Basic.pb" and do nothing pressing the button.
User avatar
JHPJHP
Addict
Addict
Posts: 1924
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Chromium Edge WebGadget

Post by JHPJHP »

Hi ricardo,
JHPJHP wrote:-- b) In the window to the right you should see the message: The connection has been opened successfully.
Did this happen after the Socket button was pressed?

The Socket button, execute script, and pressing the enter key (cursor located in the Params StringGadget) are all the same things.
- the void MessageRequester after 30 seconds is an expected result until the problem is resolved

What's frustrating is that this is a 30 second fix, but narrowing down the problem via forum messages is ridiculous.

STATUS: Mostly Unavailable :: Downloads moved to My PureBasic Stuff; free executables, access key required for source code.
_________________
ricardo
Addict
Addict
Posts: 2337
Joined: Fri Apr 25, 2003 7:06 pm
Location: Argentina

Re: Chromium Edge WebGadget

Post by ricardo »

JHPJHP wrote: Sat May 14, 2022 10:01 pm Hi ricardo,
JHPJHP wrote:-- b) In the window to the right you should see the message: The connection has been opened successfully.
Did this happen after the Socket button was pressed?
Image

Same with depth:-1
User avatar
JHPJHP
Addict
Addict
Posts: 1924
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Chromium Edge WebGadget

Post by JHPJHP »

Hi ricardo,

For whatever reason, it seems that your system it not allowing a simple HTML5 WebSocket connection.

Areas of the code were updated to try and narrow down the problem; please download the latest version.

1. Select the Socket Connection option.
2. Press the Execute Script (socket image) button.

I'm hoping a message will be displayed in the right-side window; please post your findings.

----------------------

Updated:
- added Open Script Window (up arrow image) button
- added additional error checking

Open Script Window
The button is only enabled when the Runtime.evaluate method is selected.
Makes available a larger area to write or paste script.
Tabs and New Lines are replaced with spaces when the script is returned.

STATUS: Mostly Unavailable :: Downloads moved to My PureBasic Stuff; free executables, access key required for source code.
_________________
ricardo
Addict
Addict
Posts: 2337
Joined: Fri Apr 25, 2003 7:06 pm
Location: Argentina

Re: Chromium Edge WebGadget

Post by ricardo »

It doesn't work on this computer yet.

I have installed the updated version of Edge Version 101.0.1210.47 - 64 bits running on Windows 10, without AV running.

I don't know if other users would encounter the same problem, it is possible that some would. That's why I'm interested in finding the solution.

I have tried in PB 5.73 AND PB 6


-----------------------------------------


I run a Websocket test in https://websocketstest.com/ using your webgadget

Image
User avatar
JHPJHP
Addict
Addict
Posts: 1924
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Chromium Edge WebGadget

Post by JHPJHP »

Hi ricardo,
JHPJHP wrote:I'm hoping a message will be displayed in the right-side window; please post your findings.
Was there a message?

------------------------

WebSocket Test

1. Run CE_WebGadget_Remote_Detail.pb.
2. Wait a few seconds for the list on the right (Port Listening) to settle.
3. Copy the webSocketDebuggerUrl for type: page.
-- a) Should look like the following: ws://127.0.0.1:9222/devtools/page/5F4540E7FFD8D218B7CC5FFE12BBCAF7.
4. Open your "actual" browser to https://www.piesocket.com/websocket-tester.
5. Paste the webSocketDebuggerUrl and click Connect.
6. Install the extension.
-- a) You may have to Allow extensions from other stores.
-- b) This can be removed later from [...] (Settings and more) Extensions.
7. In the top-right area of your browser click the PieSocket WebSocket Tester icon.
8. Paste the webSocketDebuggerUrl and click CONNECT.
9. Review the message; was it successful?
10. In the top-right area of your browser right-click the PieSocket WebSocket Tester icon.
11. Remove from Microsoft Edge.
Last edited by JHPJHP on Sun May 15, 2022 3:56 pm, edited 1 time in total.

STATUS: Mostly Unavailable :: Downloads moved to My PureBasic Stuff; free executables, access key required for source code.
_________________
ricardo
Addict
Addict
Posts: 2337
Joined: Fri Apr 25, 2003 7:06 pm
Location: Argentina

Re: Chromium Edge WebGadget

Post by ricardo »

JHPJHP wrote: Sun May 15, 2022 2:50 pm Hi ricardo,
JHPJHP wrote:I'm hoping a message will be displayed in the right-side window; please post your findings.
Was there a message?
Nope.


-------------------------------------


I will follow later the steps you point.

Thanks
User avatar
JHPJHP
Addict
Addict
Posts: 1924
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Chromium Edge WebGadget

Post by JHPJHP »

Hi ricardo,

Please download the lasted version; added additional error checking.
- reboot your computer before running the following test

1. Select the Socket Connection option.
2. Press the Execute Script (socket image) button.

If there's an error, a message should show in the right-side window; please post your results.

NB*: Update includes various improvements to both versions.

STATUS: Mostly Unavailable :: Downloads moved to My PureBasic Stuff; free executables, access key required for source code.
_________________
ricardo
Addict
Addict
Posts: 2337
Joined: Fri Apr 25, 2003 7:06 pm
Location: Argentina

Re: Chromium Edge WebGadget

Post by ricardo »

At the beggining it shows:

Code: Select all

[ {
   "description": "",
   "devtoolsFrontendUrl": "/devtools/inspector.html?ws=127.0.0.1:9222/devtools/page/DC03732E203EFD47A096C7C842E6B8AD",
   "faviconUrl": "https://www.youtube.com/favicon.ico",
   "id": "DC03732E203EFD47A096C7C842E6B8AD",
   "title": "YouTube",
   "type": "page",
   "url": "https://www.youtube.com/",
   "webSocketDebuggerUrl": "ws://127.0.0.1:9222/devtools/page/DC03732E203EFD47A096C7C842E6B8AD"
}, {
   "description": "",
   "devtoolsFrontendUrl": "/devtools/inspector.html?ws=127.0.0.1:9222/devtools/page/8F443BF219D1A98638886ECE4F6C5E79",
   "faviconUrl": "https://www.youtube.com/favicon.ico",
   "id": "8F443BF219D1A98638886ECE4F6C5E79",
   "parentId": "DC03732E203EFD47A096C7C842E6B8AD",
   "title": "https://accounts.google.com/ServiceLogin?service=youtube&uilel=3&passive=true&continue=https%3A%2F%2Fwww.youtube.com%2Fsignin%3Faction_handle_signin%3Dtrue%26app%3Ddesktop%26hl%3Des-419%26next%3D%252Fsignin_passive%26feature%3Dpassive&hl=es-419",
   "type": "iframe",
   "url": "https://accounts.google.com/ServiceLogin?service=youtube&uilel=3&passive=true&continue=https%3A%2F%2Fwww.youtube.com%2Fsignin%3Faction_handle_signin%3Dtrue%26app%3Ddesktop%26hl%3Des-419%26next%3D%252Fsignin_passive%26feature%3Dpassive&hl=es-419",
   "webSocketDebuggerUrl": "ws://127.0.0.1:9222/devtools/page/8F443BF219D1A98638886ECE4F6C5E79"
}, {
   "description": "",
   "devtoolsFrontendUrl": "/devtools/inspector.html?ws=127.0.0.1:9222/devtools/page/BF507CD15F65F58899CA6279289E3872",
   "id": "BF507CD15F65F58899CA6279289E3872",
   "title": "Service Worker https://www.youtube.com/sw.js",
   "type": "service_worker",
   "url": "https://www.youtube.com/sw.js",
   "webSocketDebuggerUrl": "ws://127.0.0.1:9222/devtools/page/BF507CD15F65F58899CA6279289E3872"
} ]

1. Select the Socket Connection option.
2. Press the Execute Script (socket image) button.
Nothing.
Post Reply