Distinguish Anchor Tag Click vs Window.Open

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Distinguish Anchor Tag Click vs Window.Open

Postby akjana » Tue May 09, 2017 6:22 pm

Hi

Both Anchor Tag click when target="_blank" and window.open call into OnBeforePopup. Is there a way to distinguish them ? The callback method "OnBeforePopUp" seems to be the right method.

Other Anchor Tag clicks when target="_self | _top" appear in OnBeforeBrowse as expected but the Request parameter has TransitionType populated as "CliendBackend" when its triggered from JS as opposed to "UserClicked". Would it be possible to add the request parameter to OnBeforePopup ?

Thanks
akjana
Techie
 
Posts: 39
Joined: Wed Feb 03, 2016 2:15 am

Re: Distinguish Anchor Tag Click vs Window.Open

Postby Czarek » Wed May 10, 2017 12:13 pm

What is the value of target_disposition in OnBeforePopup for both scenarios?
Maintainer of the CEF Python, PHP Desktop and CEF C API projects. My LinkedIn.
User avatar
Czarek
Virtuoso
 
Posts: 1927
Joined: Sun Nov 06, 2011 2:12 am

Re: Distinguish Anchor Tag Click vs Window.Open

Postby akjana » Thu May 11, 2017 12:38 pm

Its NewForegroundTab.

Any idea in what scenarios rest of the values get returned ?
Unknown = 0,
SuppressOpen = 1,
CurrentTab = 2,
SingletonTab = 3,
NewForegroundTab = 4,
NewBackgroundTab = 5,
NewPopup = 6,
NewWindow = 7,
SaveToDisk = 8,
OffTheRecord = 9,
IgnoreAction = 10,
akjana
Techie
 
Posts: 39
Joined: Wed Feb 03, 2016 2:15 am

Re: Distinguish Anchor Tag Click vs Window.Open

Postby Czarek » Thu May 11, 2017 1:17 pm

When OnBeforePopup is called for window.open then check popupFeatures argument, maybe it contains some unique values that allow to distinguish the call. Check also target_frame_name arg.

If that doesn't help a workaround could be to overwrite window.open using javascript bindings.
Maintainer of the CEF Python, PHP Desktop and CEF C API projects. My LinkedIn.
User avatar
Czarek
Virtuoso
 
Posts: 1927
Joined: Sun Nov 06, 2011 2:12 am

Re: Distinguish Anchor Tag Click vs Window.Open

Postby akjana » Tue May 16, 2017 12:47 pm

Thanks Czarek for the suggestions, haven't tried them yet. Will try them and get back shortly.

I think target_frame_name arg gets populated only if the caller passes a value in window.open in JS.
And good idea about overwriting window.open. For this, haven't tried it but i assume i'd need to overwrite this for IFrames as well right ? Any way to overwrite it generically so that all IFrames call the updated window.open ?
akjana
Techie
 
Posts: 39
Joined: Wed Feb 03, 2016 2:15 am


Return to Support Forum

Who is online

Users browsing this forum: Google [Bot] and 63 guests