Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WinForms - Child Window does not open when executing .click() in javascript on an anchor with target="_blank" #5048

Closed
1 task done
JimWilcox3 opened this issue Jan 30, 2025 · 2 comments

Comments

@JimWilcox3
Copy link

Is there an existing issue for this?

  • I have searched both open/closed issues, no issue already exists.

CefSharp Version

131,3,50

Operating System

Windows 11

Architecture

x64

.Net Version

.Net 4.8

Implementation

WinForms

Reproduction Steps

I have an extension method as such:

public async static Task<bool> ClickID(this IFrame frame, string ID)
{
    JavascriptResponse response = await frame.EvaluateScriptAsync("document.getElementById('" + ID + "').click()");
    return response.Success;
}

When this gets called against the following element:

<a id="myid" name="mynavform" href="/tsp/myrefercence.xhtml" target="_blank"><img src="../images/spacer.gif" border="0"><img src="../images/rightarrow.gif" alt="Right Arrow" border="0" height="15" width="15" title="Right Arrow"><img src="../images/spacer.gif" border="0"><span class="LeftNavLeaf">My Menu Option</span></a>
I expect a child window to pop up. I can use the console in the CEF browser and send a click command to the id and the child window pops up. The only time it doesn't work is programmatically.

Expected behavior

A child window opens showing the page for /tsp/myreference.xhtml

Actual behavior

Nothing happens at all when the click is called.

Regression?

I had upgraded from 118.6.80 when it quit working. I tried regressing to 130.1.90 and it didn't work. I went ahead and regressed back to 118.6.80 and it works as expected.

Known Workarounds

No response

Does this problem also occur in the CEF Sample Application

Not Tested

Other information

No response

@amaitland
Copy link
Member

Please try disabling the popup blocker.

#4940 (comment)

@amaitland amaitland changed the title Child Window does not open when clicking an anchor with target="_blank" WinForms - Child Window does not open when executing .click() in javascript on an anchor with target="_blank" Feb 3, 2025
@JimWilcox3
Copy link
Author

That did it. It is curious that this setting did not affect popups if you interacted manually with the page but only when you use frame.EvaluateScriptAsync. In any case, it works now. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants