Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.
how to access new window
how to access new window
some websites need to create new tab or window when popping up. Such as <www.cnki.net>.
When click search results, it will create a new window.
It cannot be opened rightly using url in Chromium1BeforePopup.
My question is how to acquire the browser title in new window.
keen for your help, thank you very much!
When click search results, it will create a new window.
It cannot be opened rightly using url in Chromium1BeforePopup.
My question is how to acquire the browser title in new window.
keen for your help, thank you very much!
You do not have the required permissions to view the files attached to this post.
- salvadordf
- Posts: 4564
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: how to access new window
Hi,
There are two ways to handle popup windows in CEF3 :
https://stackoverflow.com/questions/143 ... eving-text
If you use a custom window made with Delphi then you can read the TForm.Caption property. The PopupBrowser2 demo shows you how to use custom Delphi forms for the popup windows.
There are two ways to handle popup windows in CEF3 :
- Let CEF3 create the popup window.
- Use a custom Delphi form.
https://stackoverflow.com/questions/143 ... eving-text
If you use a custom window made with Delphi then you can read the TForm.Caption property. The PopupBrowser2 demo shows you how to use custom Delphi forms for the popup windows.
Re: how to access new window
Thank you very much!
I was confused. Sorry for bothering you again.
1. GetWindowText only get windows text. May I get browser title or visit browser dom.
2. PopupBrowser2 demo can not operate pop up window rightly.
Is it possible to add one demo to illustrate pop up window. Thank you!
I was confused. Sorry for bothering you again.
1. GetWindowText only get windows text. May I get browser title or visit browser dom.
2. PopupBrowser2 demo can not operate pop up window rightly.
Is it possible to add one demo to illustrate pop up window. Thank you!
- salvadordf
- Posts: 4564
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: how to access new window
Copy the code in the DOMVisitor demo and remove the TChromium.OnBeforePopup event.coater wrote: Sat Sep 29, 2018 11:51 pm 1. GetWindowText only get windows text. May I get browser title or visit browser dom.
Then replace this code in the TDOMVisitorFrm.Chromium1ContextMenuCommand procedure :
Code: Select all
MINIBROWSER_CONTEXTMENU_VISITDOM_FULL :
PostMessage(Handle, MINIBROWSER_VISITDOM_FULL, 0, 0);
Code: Select all
MINIBROWSER_CONTEXTMENU_VISITDOM_FULL :
begin
TempMsg := TCefProcessMessageRef.New(RETRIEVEDOM_MSGNAME_FULL); // Same name than TCefCustomRenderProcessHandler.MessageName
browser.SendProcessMessage(PID_RENDERER, TempMsg);
end;
Code: Select all
var
TempMsg : ICefProcessMessage;
Please, provide all the details you can if you find any issues in that demo.coater wrote: Sat Sep 29, 2018 11:51 pm 2. PopupBrowser2 demo can not operate pop up window rightly.
Is it possible to add one demo to illustrate pop up window. Thank you!
Re: how to access new window
Thank you very much!
1. Are their someways to distinguish Main browsers and Popup browser when we decide which browser could be used to process message?
2.Using Popupbrowser demo cannot open new form after click.
1. Are their someways to distinguish Main browsers and Popup browser when we decide which browser could be used to process message?
2.Using Popupbrowser demo cannot open new form after click.
You do not have the required permissions to view the files attached to this post.
- salvadordf
- Posts: 4564
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: how to access new window
If you have a ICefBrowser parameter you can check ICefBrowser.Identifier. That identifier is the same as the TChromium.BrowserID property and each browser has a unique identifier.coater wrote: Sun Sep 30, 2018 10:10 am Thank you very much!
1. Are their someways to distinguish Main browsers and Popup browser when we decide which browser could be used to process message?
Can you reproduce that issue with another website?
www.cnki.net is incredibly slow or impossible to open from my country.
Thanks!
Re: how to access new window
Thank you very much!
Sorry to bother you again and again.
I was still confused.
1.If there are many pop up browsers, how to search them and find one to process message?
1.1 If there are some functions such as browser.count or getbrowser((browser.Identifier)), and so on.
1.2 Now the only way I found is to get browser in the Chromium1LoadEnd event . are there other ways?
----
Chromium1LoadEnd(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; httpStatusCode: Integer);
TempMsg := TCefProcessMessageRef.New(BrowserToSender); // Same name than TCefCustomRenderProcessHandler.MessageName
browser.SendProcessMessage(PID_RENDERER, TempMsg) ;
--------
2.Sorry, I cannot find another one. Is it possible to use proxy to visit the website.
proxies:
http://ip.zdaye.com/FreeIPlist.html
If I can find one, I will post here.
Sorry to bother you again and again.
I was still confused.
1.If there are many pop up browsers, how to search them and find one to process message?
1.1 If there are some functions such as browser.count or getbrowser((browser.Identifier)), and so on.
1.2 Now the only way I found is to get browser in the Chromium1LoadEnd event . are there other ways?
----
Chromium1LoadEnd(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; httpStatusCode: Integer);
TempMsg := TCefProcessMessageRef.New(BrowserToSender); // Same name than TCefCustomRenderProcessHandler.MessageName
browser.SendProcessMessage(PID_RENDERER, TempMsg) ;
--------
2.Sorry, I cannot find another one. Is it possible to use proxy to visit the website.
proxies:
http://ip.zdaye.com/FreeIPlist.html
If I can find one, I will post here.
- salvadordf
- Posts: 4564
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: how to access new window
Create a list or dynamic array of ICefBrowser interfaces and add the "browser" instances in the TChromium.OnAfterCreated event.coater wrote: Sun Sep 30, 2018 10:58 am Thank you very much!
Sorry to bother you again and again.
I was still confused.
1.If there are many pop up browsers, how to search them and find one to process message?
1.1 If there are some functions such as browser.count or getbrowser((browser.Identifier)), and so on.
1.2 Now the only way I found is to get browser in the Chromium1LoadEnd event . are there other ways?
----
Chromium1LoadEnd(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; httpStatusCode: Integer);
TempMsg := TCefProcessMessageRef.New(BrowserToSender); // Same name than TCefCustomRenderProcessHandler.MessageName
browser.SendProcessMessage(PID_RENDERER, TempMsg) ;
--------
Use the TChromium.OnBeforeClose or the TChromium.OnClose to remove them from your list or array.
Edit : By "removing" I mean setting them to NIL to decrease the reference count.
I finally could open that "pyrolysis" link using a proxy.coater wrote: Sun Sep 30, 2018 10:58 am 2.Sorry, I cannot find another one. Is it possible to use proxy to visit the website.
proxies:
http://ip.zdaye.com/FreeIPlist.html
If I can find one, I will post here.
CEF3 triggers the TChromium.OnBeforePopup in that link and the value for the targetDisposition parameter is WOD_NEW_FOREGROUND_TAB.
The PopupBrowser2 demo only shows new popup windows when targetDisposition is WOD_NEW_POPUP but you can ignore that and open as popup anything that has these targetDisposition values : WOD_NEW_FOREGROUND_TAB, WOD_NEW_BACKGROUND_TAB, WOD_NEW_WINDOW or WOD_NEW_POPUP.
Re: how to access new window
I got it.
Thank you very much!!!
Thank you very much!!!
Re: how to access new window
Is it a bug?
------------
var
BrowserList: TList<ICefBrowser>;
---------
BrowserList:=Tlist<ICefBrowser>.Create; //uses Generics.Collections ,formshow procedure.
---------
-----------//add ICefBrowser to list
procedure TIinformSearchFrm.Chromium1AfterCreated(Sender: TObject;
const browser: ICefBrowser);
begin
memo1.Lines.Add(inttostr(browser.Identifier));//new browser has been created.
BrowserList.Add(browser);
end;
-------
I opened a new window,
the code below works.
--------
TempBrowser:=(BrowserList.Items[1)]) ; // item1 browser
TempMsg := TCefProcessMessageRef.New(BrowserToSender);
if TempBrowser<>nil then TempBrowser.SendProcessMessage(PID_RENDERER, TempMsg);
-------
If I opened another new window, The count of BrowserList is 3.
But the code below not work. Is this a bug?
--------
TempBrowser:=(BrowserList.Items[2)]) ;
TempMsg := TCefProcessMessageRef.New(BrowserToSender);
if TempBrowser<>nil then TempBrowser.SendProcessMessage(PID_RENDERER, TempMsg);
--------
////////////////////////////
This also happened if I got browser in Chromium1LoadEnd.
----------------------------
procedure TIinformSearchFrm.Chromium1LoadEnd(Sender: TObject;
const browser: ICefBrowser; const frame: ICefFrame; httpStatusCode: Integer);
var TempMsg : ICefProcessMessage;
const BrowserToSender='string';
begin
Popupbrowser:=browser; // Popupbrowser.SendProcessMessage only work when browser.identifier=2;
end;
---------------------
///////////////////////
keen for your help, thank you very much!
------------
var
BrowserList: TList<ICefBrowser>;
---------
BrowserList:=Tlist<ICefBrowser>.Create; //uses Generics.Collections ,formshow procedure.
---------
-----------//add ICefBrowser to list
procedure TIinformSearchFrm.Chromium1AfterCreated(Sender: TObject;
const browser: ICefBrowser);
begin
memo1.Lines.Add(inttostr(browser.Identifier));//new browser has been created.
BrowserList.Add(browser);
end;
-------
I opened a new window,
the code below works.
--------
TempBrowser:=(BrowserList.Items[1)]) ; // item1 browser
TempMsg := TCefProcessMessageRef.New(BrowserToSender);
if TempBrowser<>nil then TempBrowser.SendProcessMessage(PID_RENDERER, TempMsg);
-------
If I opened another new window, The count of BrowserList is 3.
But the code below not work. Is this a bug?
--------
TempBrowser:=(BrowserList.Items[2)]) ;
TempMsg := TCefProcessMessageRef.New(BrowserToSender);
if TempBrowser<>nil then TempBrowser.SendProcessMessage(PID_RENDERER, TempMsg);
--------
////////////////////////////
This also happened if I got browser in Chromium1LoadEnd.
----------------------------
procedure TIinformSearchFrm.Chromium1LoadEnd(Sender: TObject;
const browser: ICefBrowser; const frame: ICefFrame; httpStatusCode: Integer);
var TempMsg : ICefProcessMessage;
const BrowserToSender='string';
begin
Popupbrowser:=browser; // Popupbrowser.SendProcessMessage only work when browser.identifier=2;
end;
---------------------
///////////////////////
keen for your help, thank you very much!