Welcome Guest Search | Active Topics | Sign In | Register

Showing nothing on EO.Web browser when page is loading with beforeNavigate event Options
Keyur
Posted: Thursday, October 13, 2016 6:47:31 AM
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.
eo_support
Posted: Thursday, October 13, 2016 8:54:53 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,067
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!
Keyur
Posted: Friday, October 14, 2016 2:23:02 AM
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.
eo_support
Posted: Friday, October 14, 2016 2:33:50 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,067
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!
Keyur
Posted: Monday, October 17, 2016 3:24:03 AM
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)?
eo_support
Posted: Monday, October 17, 2016 10:54:30 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,067
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.aspx

We will investigate further once we have the test project.

Thanks!
Keyur
Posted: Tuesday, October 25, 2016 6:42:14 AM
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>
eo_support
Posted: Tuesday, October 25, 2016 10:00:11 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,067
Hi,

Did you handle NewWindow event?

Thanks!
Keyur
Posted: Wednesday, October 26, 2016 2:13:27 AM
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?
eo_support
Posted: Wednesday, October 26, 2016 9:05:13 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,067
Hi,

You can do that by:

1. Not accepting the new WebView in your NewWindow event;
2. Launch your browser with e.TargetUrl;

Thanks!
Keyur
Posted: Wednesday, October 26, 2016 9:12:00 AM
Rank: Member
Groups: Member

Joined: 10/13/2016
Posts: 11
Thanks, do i lanuch my browser with e.TargetURL in new window event?
Keyur
Posted: Wednesday, October 26, 2016 9:12:32 AM
Rank: Member
Groups: Member

Joined: 10/13/2016
Posts: 11
Thanks, do i lanuch my browser with e.TargetURL in new window event?
eo_support
Posted: Wednesday, October 26, 2016 9:18:35 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,067
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!
Keyur
Posted: Wednesday, October 26, 2016 9:59:03 AM
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?
eo_support
Posted: Wednesday, October 26, 2016 10:07:35 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,067
Please read here for more details:

https://www.essentialobjects.com/doc/webbrowser/advanced/new_window.aspx

You 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!
Keyur
Posted: Friday, November 4, 2016 4:41:00 AM
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?
eo_support
Posted: Friday, November 4, 2016 7:52:17 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,067
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.


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.