0

I have a problem with CefSharp. I want the browser to automatically open an external app when the time gets. But it doesn't work.

After the last click event from the Button, it always shows a blank page.

I tried this: How to open a link in a native browser from CefSharp 3 But it doesn't work.

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.-->
Stan1k
  • 338
  • 2
  • 17
etkmlm
  • 53
  • 1
  • 6
  • What have you tried? What does clicking your button actually do? – amaitland Dec 29 '20 at 22:41
  • Actually button must open an exe. But it opens a blank page. – etkmlm Dec 30 '20 at 09:24
  • Please edit your original question and provide a sample of the html. How does the website behave in Chrome? – amaitland Dec 30 '20 at 09:43
  • I'll add a video tomorrow. Site subject is a lesson. And it has its own program in the computer. When clicked the button, the program automatically opens and the lesson starts. – etkmlm Dec 30 '20 at 16:39
  • Please don't add a video, provide an example of the html that's relevant. – amaitland Dec 30 '20 at 19:02
  • I updated the question with HTML codes. – etkmlm Dec 31 '20 at 13:26
  • 1
    Unfortunately doesn't help. My best guess is it's launching an external protocol, see https://github.com/cefsharp/CefSharp/wiki/General-Usage#protocol-execution for an example of implementing mailto – amaitland Dec 31 '20 at 19:15
  • Thanks, it worked. App opening normally. Sorry, I couldn't reply early. – etkmlm Jan 04 '21 at 08:07

0 Answers0