如何修改CefSharp中远程调试URL的标题?

huangapple go评论58阅读模式
英文:

How to modify the title of remote debug url in CefSharp?

问题

我在WinForm中使用CefSharp创建了一个浏览器,根据用户的配置,浏览器会显示不同的内容。当打开远程调试(http://localhost:9999)时,URL链接始终显示标题为test page。如果我创建两个实例,我无法区分它们。

如何在代码中修改标题?是否有任何CefSharp配置可以添加以修改远程调试页面的标题?

[{
   "description": "",
   "devtoolsFrontendUrl": "/devtools/inspector.html?ws=localhost:9999/devtools/page/5D72AFB9FF36FE8389138F51ED9A9735",
   "id": "5D72AFB9FF36FE8389138F51ED9A9735",
   "title": "test page",
   "type": "page",
   "webSocketDebuggerUrl": "ws://localhost:9999/devtools/page/5D72AFB9FF36FE8389138F51ED9A9735"
}]
英文:

I made a browser using cefsharp in winform, the browser will show different content based on user's configuration. When open remote debug(http://localhost:9999), the url link always show the title test page. If I create two instances, I could not tell them apart.
How to modify the title in code? Is there any CefSharp configuration I can add to modify the title in remote debugging page?

[ {
   "description": "",
   "devtoolsFrontendUrl": "/devtools/inspector.html?ws=localhost:9999/devtools/page/5D72AFB9FF36FE8389138F51ED9A9735",
   "id": "5D72AFB9FF36FE8389138F51ED9A9735",
   "title": "test page",
   "type": "page",
   "webSocketDebuggerUrl": "ws://localhost:9999/devtools/page/5D72AFB9FF36FE8389138F51ED9A9735"
}]

答案1

得分: 1

没有配置选项可以修改远程调试中显示的 titletitle 应该与您的网页的 <title> 完全一致。如果您希望在开发工具中区分它们,您需要为每个页面提供唯一的标题。

如果需要,您可以执行JavaScript来更改您的网页标题(或者只需更改您的HTML)。

英文:

There's no configuration option for modifying the title show in remote debugging. The title should exactly reflect the &lt;title&gt; of your web page. You need to give you pages unique titles if you want them to be distinguished in devtools.

You can execute JavaScript to change your web page title if needed (or simply change your html).

huangapple
  • 本文由 发表于 2023年6月12日 12:45:44
  • 转载请务必保留本文链接:https://go.coder-hub.com/76453710.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定