Welcome Guest Search | Active Topics | Sign In | Register

invoking javascript window.resizeTo and window.resizeBy Options
Christian Porzio
Posted: Wednesday, October 31, 2018 12:53:00 PM
Rank: Advanced Member
Groups: Member

Joined: 10/4/2016
Posts: 104
Hi,

It looks like calling the javscript functions:
Code: JavaScript
window.resizeTo(newWidth,newHeight
or
Code: JavaScript
window.resizeBy(incWidth,incHeight)
has no effect from a EO Browser.

I am not surprised considering we control the size of the window.

Just that I do not see obvious handlers that we could use to intercept the fact the page invoked either one of these functions, and then we would handling it from there.

Could you please advise on this matter what would be the best approach to handle those calls?

Would you for instance recommend to overwrite them from our wrapper? Or is there events we could hook up to handle them?

Thank you for your input on this matter.
eo_support
Posted: Thursday, November 1, 2018 12:14:17 PM
Rank: Administration
Groups: Administration

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

This is one of the cases that highlight the difference between a standalone application and an embedder. It probably is not a good idea for us to define any default behavior for such calls. So you may want to implement them yourself however way you want ---- you can simply inject something like this (through WebView.JSInitCode):

Code: C#
window.resizeTo = function(width, height)
{
    //Put your own implementation here or use JavaScript extension feature to call into the .NET code
}


If you do call into .NET code, make sure your .NET code does not resize the WebView synchronously. Use something like BeginInvoke to do it asynchronously.

Thanks
Christian Porzio
Posted: Thursday, November 1, 2018 1:19:36 PM
Rank: Advanced Member
Groups: Member

Joined: 10/4/2016
Posts: 104
Thank you, and yes I fully understand why there is no default behavior.
eo_support
Posted: Thursday, November 1, 2018 4:14:12 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,221
You are welcome. :)


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.