chromelyapps / Chromely

Build Cross Platform HTML Desktop Apps on .NET using native GUI, HTML5, JavaScript, CSS, Owin, AspNetCore (MVC, RazorPages, Blazor)
MIT License
2.98k stars 280 forks source link

Running Child Window #179

Closed mikart143 closed 4 years ago

mikart143 commented 4 years ago

Hello! I from scientific project Legendary Rover I am trying to open a child window but I am stuck. I was following #166 for Blazor server side support. I am so happy that this is working. I am trying now to open a child window. At the end of issue the author suggested that this should be working in some time. I am able to open a website(e.x chromely github) but on my default browser. I am using demo server app. I am unable to open any sub page in new window. Script to run new window:

    public async Task OpenLink()
    {
        await JSRuntime.InvokeAsync<object>("open", "/todolist", "_blank");
    }

After hitting button several times I am getting this output to my console:

On CefGlue child process launch arguments: "C:\Users\mikar\Downloads\demo-projects-master\demo-projects-master\blazor\ServerAppDemo\bin\Debug\netcoreapp3.1\ServerAppDemo.exe" --type=gpu-process --field-trial-handle=2932,13652247102979825757,2598083567635324185,131072 --disable-features=OutOfBlinkCors --disable-gpu-sandbox --use-gl=disabled --no-sandbox --locales-dir-path="C:\Users\mikar\Downloads\demo-projects-master\demo-projects-master\blazor\ServerAppDemo\bin\Debug\netcoreapp3.1\locales" --log-file="logs\chromely.cef_20200411.log" --log-severity=info --resources-dir-path="C:\Users\mikar\Downloads\demo-projects-master\demo-projects-master\blazor\ServerAppDemo\bin\Debug\netcoreapp3.1\" --lang=en-US --default-encoding=utf-8 --allow-file-access-from-files --allow-universal-access-from-files --disable-web-security --ignore-certificate-errors /prefetch:2 2020-04-11 17:04:18.963 [INFO] Running Windows chromium 77.0.3865.120 2020-04-11 17:04:20.510 [INFO] Sub process executes successfully with code: 0

Log file chromely.cef_20200411.log

[0411/165457.760:INFO:CONSOLE(1)] "[2020-04-11T14:54:57.758Z] Information: Normalizing '_blazor' to 'https://127.0.0.1:5050/_blazor'.", source: https://127.0.0.1:5050/_framework/blazor.server.js (1) [0411/165457.805:INFO:CONSOLE(1)] "[2020-04-11T14:54:57.805Z] Information: WebSocket connected to wss://127.0.0.1:5050/_blazor?id=iG4MMxs1YgG67-uVM2JhUQ.", source: https://127.0.0.1:5050/_framework/blazor.server.js (1) [0411/165525.911:INFO:CONSOLE(1)] "[2020-04-11T14:55:25.909Z] Error: Connection disconnected with error 'Error: WebSocket closed with status code: 1006 ().'.", source: https://127.0.0.1:5050/_framework/blazor.server.js (1) [0411/165525.979:ERROR:broker_win.cc(55)] Error reading broker pipe: The pipe has been ended. (0x6D) [0411/165525.981:ERROR:broker_win.cc(137)] Error sending sync broker message: The pipe is being closed. (0xE8) [0411/165827.656:INFO:CONSOLE(1)] "[2020-04-11T14:58:27.655Z] Information: Normalizing '_blazor' to 'https://127.0.0.1:5050/_blazor'.", source: https://127.0.0.1:5050/_framework/blazor.server.js (1) [0411/165827.702:INFO:CONSOLE(1)] "[2020-04-11T14:58:27.701Z] Information: WebSocket connected to wss://127.0.0.1:5050/_blazor?id=kps0UzrABUYrQY3V3vYHcg.", source: https://127.0.0.1:5050/_framework/blazor.server.js (1) [0411/165858.924:INFO:CONSOLE(1)] "[2020-04-11T14:58:58.923Z] Error: Connection disconnected with error 'Error: WebSocket closed with status code: 1006 ().'.", source: https://127.0.0.1:5050/_framework/blazor.server.js (1) [0411/170059.495:INFO:CONSOLE(1)] "[2020-04-11T15:00:59.494Z] Information: Normalizing '_blazor' to 'https://127.0.0.1:5050/_blazor'.", source: https://127.0.0.1:5050/_framework/blazor.server.js (1) [0411/170059.541:INFO:CONSOLE(1)] "[2020-04-11T15:00:59.541Z] Information: WebSocket connected to wss://127.0.0.1:5050/_blazor?id=0BmtFKgJ2DFEGDP6chYjeA.", source: https://127.0.0.1:5050/_framework/blazor.server.js (1) [0411/170246.287:WARNING:render_delay_buffer.cc(343)] Applying total delay of 5 blocks. [0411/170246.419:INFO:CONSOLE(0)] "The 'options' directive has been replaced with 'unsafe-inline' and 'unsafe-eval' source expressions for the 'script-src' and 'style-src' directives. Please use those directives instead, as 'options' has no effect.", source: https://html5test.com/assets/csp.html (0) [0411/170249.857:WARNING:angle_platform_impl.cc(52)] compileToBinary(259): C:\fakepath(75,10-54): warning X3571: pow(f, e) will not work for negative f, use abs(f) or conditionally handle negative values if you expect them C:\fakepath(97,10-54): warning X3571: pow(f, e) will not work for negative f, use abs(f) or conditionally handle negative values if you expect them [0411/170251.953:INFO:CONSOLE(1)] "[2020-04-11T15:02:51.954Z] Error: Connection disconnected with error 'Error: WebSocket closed with status code: 1006 ().'.", source: https://127.0.0.1:5050/_framework/blazor.server.js (1) [0411/170406.044:INFO:CONSOLE(1)] "[2020-04-11T15:04:06.043Z] Information: Normalizing '_blazor' to 'https://127.0.0.1:5050/_blazor'.", source: https://127.0.0.1:5050/_framework/blazor.server.js (1) [0411/170406.099:INFO:CONSOLE(1)] "[2020-04-11T15:04:06.099Z] Information: WebSocket connected to wss://127.0.0.1:5050/_blazor?id=pY43Dke_zz9xW73l0XPETg.", source: https://127.0.0.1:5050/_framework/blazor.server.js (1)

Happy Easter !! 🥚 🐔

mattkol commented 4 years ago

@mikart143

The fix is here - https://github.com/chromelyapps/Chromely/issues/166#issuecomment-601215913 I was to do a nuget update, just totally forgot with what is happening.

I just updated the nugets.

mikart143 commented 4 years ago

Everything works great but new window points to home not to todolist page. I do not if this is connected to this example or this is not implemented yet

mattkol commented 4 years ago

That makes sense to me. These are 2 separate frameworks that are likely to handle Absolute and Relative paths differently. If the absolute path works, that should be all that is needed.

Try change the path to something familiar like youTube page - "https://www.youtube.com/embed/cMNPPgB0_mU" for a quick test.

If that works, to make the relative path work, then a custom handler may be required.

    public class DemoChromelyApp : ChromelyBasicApp
    {
        public override void Configure(IChromelyContainer container)
        {
            base.Configure(container);
            // Custom handlers
            container.RegisterSingleton(typeof(IChromelyCustomHandler), Guid.NewGuid().ToString(), typeof(CustomLifeSpanHandler));
---
        }
    }

   public class CustomLifeSpanHandler : CefGlueLifeSpanHandler
   {
   }

But my advise will be to see how absolute path is passed from html. That will be far less work.

mikart143 commented 4 years ago

I turned out that this was demo error. With pure template everything works