|
Rank: Member Groups: Member
Joined: 10/13/2016 Posts: 11
|
I am exploring EO.Web browser control to use in our product. I want to replace Window web browser control with EO.Web browser. I am using without license version in my sample code.
Sometimes page doesn't properly render in Web browser control. Nothing display on web browser control. without subscribing beforeNavigate event, it is working fine, Issue happens when i tried to use frequently for testing purpose. I have observed that as soon as i added beforeNavigate event , i can see issue.
Please do needful.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,229
|
Hi,
Make sure your BeforeNavigate event handler:
1. Returns very fast. Because BeforeNavigate event blocks everything else, the browser engine has a very short timer on it. If the timer expires before your BeforeNavigate event returns, then the navigation will be canceled; 2. Do not explicitly cancel the request. If you explicitly cancel the request in your BeforeNavigate event, the request will be canceled as well and nothing will be loaded; 3. Do not throw an exception;
Please let us know if this resolves the issue for you.
Thanks!
|
|
Rank: Member Groups: Member
Joined: 10/13/2016 Posts: 11
|
Thanks for your inputs. Issue has been resolved after remove cancel request in beforeNavigate event. How can i prevent to redirect URL on BeforeNavigate Event?
2. Any suggestion, when we load page first time, it is taking around 10 seconds.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,229
|
Hi,
Setting e.Cancel to true in BeforeNavigation is the correct way to cancel a navigation request. However you must be very careful only cancel requests you wish to cancel --- otherwise you will get blank pages. Specifically, you should check e.OldUrl and e.FrameName. If e.OldUrl is empty (or is about:blank) or e.FrameName is not empty, then this is a new load and you should not cancel it.
It's normal that a page takes a bit longer to load on the first run. There are two things that must be done on the first run: 1. Initialize the browser engine. 2. Build the initial cache. If you close the application and then start it again, step 1 will take place again, however step 2 will be skipped. So subsequent loading should be much faster.
Thanks!
|
|
Rank: Member Groups: Member
Joined: 10/13/2016 Posts: 11
|
Thanks,
When we will click on link from EO.Browser, beforeNavigate event fire twice. I can't put check with two condition as you mentioned in your reply because e.OldUrl always get value and e.FrameName always get empty value.
I want to put e.cancel = true when i will get EO.WebBrowser.NavigationType.LinkClicked type but it is again fire beforeNavigate event.
How can i stop twice time execute event when i click on any link(EO.WebBrowser.NavigationType.LinkClicked)?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,229
|
Hi, It can fire many times for different type of request. For example, if you have a child iframe and you navigate to another page that loads something else to a different child iframe, then BeforeNavigate will fire for both the main frame and the child iframe. If you navigate to a different Url and that Url automatically redirects to another Url, then you will see it fire more than once as well. The key is for you to identify the first link clicked BeforeNavigate and only cancel that one. If you have problems identify the first request or the event is fired multiple times for the same request (it should not happen), please try to isolate the problem into a test project and send the test project to us, see here for more details: https://www.essentialobjects.com/forum/test_project.aspxWe will investigate further once we have the test project. Thanks!
|
|
Rank: Member Groups: Member
Joined: 10/13/2016 Posts: 11
|
Thanks for your suggestion and inputs, we have purchased license of the EO.web browser control. After integration control in our product, hyper link doesn't open from EO.web browser control. I have subscribe before navigate event, isLoading and beforeContext menu event as per my requirement.
When i click on hyper link, no such event execute on click. Can you please suggest me proper solution?
This is my html code.
<span class="feeditemfirstentity"><a href="/005i0000001g04I" class="actorentitylink" data-hovid="005i0000001g04I">Jerret Kasper</a></span> (<a href="/0D5i000004F3xEj" class="feeditemsecondentity" target="_blank">originally posted</a> by <a href="/005i0000001g04I" class="feeditemsecondentity" data-hovid="005i0000001g04I" target="_blank">Jerret Kasper</a>) posted a file.</span>
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,229
|
Hi,
Did you handle NewWindow event?
Thanks!
|
|
Rank: Member Groups: Member
Joined: 10/13/2016 Posts: 11
|
Yes, I handle NewWindow event in my code, but i don't want to open in Newwindow form. I want to open in browser( browser means , link will be open in browser not in web browser control) Is it possible?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,229
|
Hi,
You can do that by:
1. Not accepting the new WebView in your NewWindow event; 2. Launch your browser with e.TargetUrl;
Thanks!
|
|
Rank: Member Groups: Member
Joined: 10/13/2016 Posts: 11
|
Thanks, do i lanuch my browser with e.TargetURL in new window event?
|
|
Rank: Member Groups: Member
Joined: 10/13/2016 Posts: 11
|
Thanks, do i lanuch my browser with e.TargetURL in new window event?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,229
|
Keyur wrote:Thanks, do i lanuch my browser with e.TargetURL in new window event? That part has nothing do with EO.WebBrowser since you are launching it in your own browser. You can do it whenever you want. These two things have to do with EO.WebBrowser: 1. You will obviously need to handle NewWindow event in order to get e.TargetUrl; 2. You should NOT accept the new WebView in your NewWindow event handler since you will be loading the new Url yourself; Thanks!
|
|
Rank: Member Groups: Member
Joined: 10/13/2016 Posts: 11
|
I haven't created new WebView. So, what do you mean by not accepting new WebView? Can you please explain?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,229
|
Please read here for more details: https://www.essentialobjects.com/doc/webbrowser/advanced/new_window.aspxYou can also take a look of the source code in the TabbedBrowser sample application to see how NewWindow event is supposed to be handled. If it's confusing to you, then just take e.TargetUrl and launch it in your own browser and do NOT do anything else in your event handler. Thanks!
|
|
Rank: Member Groups: Member
Joined: 10/13/2016 Posts: 11
|
Thanks for your inputs.
I am getting Unable to cast object of type 'EO.WebBrowser.JSUndefined' to type 'System.String' error while passing string "[Keyur]" in my JS method from C# code.
C# Code ====================== string objectId = "[Keyur]"; public string GetValue(string objectId) {
return (string)WebViewContent.InvokeFunction("getValue", new object[] { objectId }); }
========================== Web Page Javascript function : =========================== var test = new Array();
function getIdByName(name) { return test[name]; } =========================== Getting following error Unable to cast object of type 'EO.WebBrowser.JSUndefined' to type 'System.String'
Any suggestion?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,229
|
The error message is pretty clear. If you want to cast it to a string on the C# side, make sure you return a string from your JS code. If you return anything other than a string (including an "undefined" value), you will get an invalid cast error. This is just basic coding errors. You need to troubleshoot this kind of issues yourselves.
|
|