c# - 在 CefSharp 中允许外部应用程序
问题描述
我对 CefSharp 有疑问。我希望浏览器在时间到时自动打开一个外部应用程序。但它不起作用。
在最后一个之后click event
,Button
它总是显示一个空白页。
我试过这个: How to open a link in a native browser from CefSharp 3 但它不起作用。
public partial class CefTest : Form
{
public CefTest()
{
InitializeComponent();
}
public ChromiumWebBrowser browser;
private void CefTest_Load(object sender, EventArgs e)
{
CefInitialize();
browser.FrameLoadEnd += Browser_FrameLoadEnd;
}
private void Browser_FrameLoadEnd(object sender, FrameLoadEndEventArgs e)
{
browser.ExecuteScriptAsync("document.getElementById('tckn').value='...'");
browser.ExecuteScriptAsync("document.getElementById('password').value='...'");
browser.ExecuteScriptAsync("document.getElementsByClassName('nl-form-send-btn')[0].click()");
browser.ExecuteScriptAsync("if (document.getElementById('joinMeeting') != null) document.getElementById('joinMeeting').click()");
browser.ExecuteScriptAsync("document.getElementById('join').click()"); //When this clicked, it must open external app. But it shows blank page.
}
public void CefInitialize()
{
CefSettings settings = new CefSettings();
Cef.Initialize(settings);
browser = new ChromiumWebBrowser("https://giris.eba.gov.tr/EBA_GIRIS/giris.jsp");
browser.Dock = DockStyle.Fill;
panel1.Controls.Add(browser);
}
}
<!--This is first box.-->
<div class="card shadow mb-5 rounded">
<h4 class="info-text mb-3 mt-1" id="live-title">Human in Nature</h4>
<h4 class="info-text mb-3">
<span id="course-name">English</span>
</h4>
<h4 class="mb-4"><i class="far fa-clock"></i> <span id="live-times">15.50 - 16.20</span></h4>
<a id="joinMeeting" href="" class="btn btn-warning disabled mb-2">Join Now</a>
</div>
<!--This opens when clicked button (joinMeeting)-->
<div class="modal-content">
<a id="cancel" class="btn btn-secondary" data-dismiss="modal">Cancel</a>
<a id="join" class="btn btn-success" data-dismiss="modal"><i class="fas fa-video"></i>Join</a>
</div>
<!--This is opens when clicked button (join) and starts lesson timer.-->
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="remainingTimeModalLabel">Countdown</h5>
<div style="text-align:center;">Time Left: <b><span id="remaining_time_popup_text">4</span>sn</b></div>
</div>
</div>
<!--When the timer finishes counting, "EBA Live Course.exe" starts automatically.-->
解决方案
推荐阅读
- python - 在python中矢量化for循环
- asp.net - IdentityServer3 - 客户端证书验证
- image-processing - FIR Filter for image resampling by non integer factor
- ruby - 您将如何重构此方法以将 ABC 大小减少到 15 以下?
- json - 使用 jq 将 JSON {"k1":"v1","k2":"v2"} 转换为 CSV: v1,v2
- github-api - Github API:如何获取已为 repo 加注星标并克隆它的用户列表
- java - Java - 在使用随机获取文本文件中的行时尝试避免重复
- php - 使用 PHP 在 WordPress 站点中搜索字符串并替换为新字符串
- laravel - 数据透视表中的 detach()
- python-3.x - ReadProcessMemory 无效句柄