Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread |
Messages 1 to 9 of 9 total |
"Injecting code" |
Wed, Jun 26 2013 8:59 AM | Permanent Link |
Matthew Jones | I'm wanting to run my web page in a Chromium browser in a desktop application. That
part is easy. But I'd like to be able to tell the code that it is hosted thus, and so I figured I could call a function by running some javascript "live". There are two issues here. First, how mad I am, and the second is how to call my function, the third being how I could do this when it is all compressed anyway. Assuming I am not mad, my function is defined thus: fcontrol_tfrmcontrol.$p.tfrmcontrol_hostedmodeactivate = function() { var $t = this; $t.tfrmcontrol_m_bhostedmode = true; $t.tfrmcontrol_setstatus("Hosted mode active"); }; The status can be ignored, but if anyone has a suggestion on how to either call this or set that variable, please say. I know that this code works in the browser container: crm.Browser.MainFrame.ExecuteJavaScript( 'window.scrollTo(0,0);', '', 0); //about:blank I suspect that the better option will be to recognise the browser type, but I haven't found how to set that yet. /Matthew Jones/ |
Wed, Jun 26 2013 9:20 AM | Permanent Link |
Matthew Jones | > I suspect that the better option will be to recognise the browser
> type, but I haven't found how to set that yet. Okay, found that, so I've added an Embedded marker, and I will use that. But I'd still like to know if the main question is possible, and how I could do it compressed too. /Matthew Jones/ |
Wed, Jun 26 2013 11:15 AM | Permanent Link |
Matthew Jones | > > I suspect that the better option will be to recognise the browser
> > type, but I haven't found how to set that yet. > > Okay, found that, so I've added an Embedded marker, I can't believe how hard these things are! I can't believe I'm the only one doing these basic things, but Chromium (Delphi implementation) is hardly documented, but seems to have no way to remove the scroll bars. It does allow me to permanently set the browser. The scroll bars being a pain, I switched to the IE embedded browser, which also has stupid scroll bars, but I worked out (thanks Google and StackOverflow) how to remove those, but now I can't set the user agent to detect it. Well, you can set it for the first navigate, but then it is back to default unless you intercept and cancel each navigate and repeat it. WTF? Back to Chromium for a bit, to see if I can do the same style hack. I need to know how to set the body style to 'overflow=hidden' within EWB. Any one got any clues? /Matthew Jones/ |
Wed, Jun 26 2013 11:29 AM | Permanent Link |
Matthew Jones | THTMLDocument(window.document).body.style.overflow := 'hidden';
This kills the scroll bars in Chromium (and probably IE). Chromium currently winning in the feasible solution stakes... /Matthew Jones/ |
Thu, Jun 27 2013 10:23 AM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Matthew,
<< THTMLDocument(window.document).body.style.overflow := 'hidden'; >> Here's the slimmer version: GetBodyElement.style.overflow:='hidden'; GetBodyElement is defined in the WebDOM unit. Tim Young Elevate Software www.elevatesoft.com |
Thu, Jun 27 2013 11:08 AM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Matthew,
<< I'm wanting to run my web page in a Chromium browser in a desktop application. That part is easy. But I'd like to be able to tell the code that it is hosted thus, and so I figured I could call a function by running some javascript "live". >> Why not just create a global variable in an external JS file (include with project), and then access it from the EWB code using an external variable declaration: JS: hostedChromium = true; EWB: var external hostedChromium: Boolean; Then just reference as normal in EWB. Tim Young Elevate Software www.elevatesoft.com |
Thu, Jun 27 2013 11:12 AM | Permanent Link |
Matthew Jones | > GetBodyElement.style.overflow:='hidden';
Thanks - adopted. /Matthew Jones/ |
Thu, Jun 27 2013 11:39 AM | Permanent Link |
Matthew Jones | Presumably I'd have to source the javascript with the option from a local place
instead of the server. I could do that. By hosted, I really mean a custom browser that is smart. This works nicely at the moment, by having a timer that scans the HTML for a particular sequence of letters in an invisible TLabel. The code then just does a MyLabel.Caption := 'ToHost:' + IntToStr(Width) + ';' and if that has changed, sets the host window width to that size. Thus the host browser takes up no more space than is needed. But for a normal browser, it works just fine too. /Matthew Jones/ |
Tue, Jul 2 2013 8:16 AM | Permanent Link |
Matthew Jones | FWIW, I ended up using a URL parameter in the hosted browser, which works for
debugging in Chrome too! /Matthew Jones/ |
This web page was last updated on Wednesday, April 24, 2024 at 11:07 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |