MicrosoftEdge / MicrosoftEdge/WebView2Feedback

Can't view/debug script when using NavigateToString

Open
#1,007 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature request tracked
Dominant language
PowerShell
Stars
526
Forks
67
PR merge metrics
No merged PRs in 30d

Description

I am unable to view or debug the webview script when the script is set via NavigateToString

debug

To reproduce:

  • Start with the win32 WebView2GettingStarted solution
  • Instead of Navigate('bing.com') use NavigateToString() and load some HTML with javascript
    webviewWindow->NavigateToString(LR"(
      <html><head>
      <script>
        window.addEventListener('DOMContentLoaded', ()=>{
          document.body.querySelector('div').textContent = 'Goodbye'; 
        };
      </script>
      </head>
      <body>
      <div>Hello</div>
      <div>World</div>
      </body>
    </html>)");
    
  • Run the app and open the developer
  • There is no script available on the Sources tab

Versions

Visual Studio: 16.8.6
MSVC v142
WebView2 1.0.705.50 via nuget
Win32
Win10 18363

AB#31911694

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Win32 WebView2GettingStarted solution and reproduce the issue by replacing Navigate('bing.com') with NavigateToString() using the HTML and JavaScript shown. Inspect the developer tools Sources tab and compare the behavior with a normal navigation. Done means the inline script loaded through NavigateToString is visible and debuggable there.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, javascript
Domain
desktop, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.