Bootstrap does not work with Awesomium
Opened this issue · 11 comments
Tested with 1.7.5.1 (.Net)
To reproduce browse to http://getbootstrap.com/getting-started/ with an Awesomium Web view. You will notice that the menus are collapsed into the drop-down because somehow bootstrap fails to see the page size. The difference can be seen straight away when comparing with Chrome for example.
Executing $(document).ready()
in the dev console seems to make bootstrap work properly again. But this cannot be used as a workaround because calling that function from script has no effect, as far as I see it. See: http://stackoverflow.com/questions/30621677/events-similar-to-document-ready-to-be-used-as-workaround-for-issue-with-bootstr?noredirect=1#comment49310914_30621677
I have this same problem with v1.7.5.1 C++. Bootstrap sites do not align properly by default. However if I open the remote debugger for the view, it magically fixes itself after the remote debugger finishes loading.
I found a workaround for the time being. It is not the most elegant way to fix this but it does work.
You need to have a 'load' listener set for your web view. You can do that like this:
this->m_WebView->set_load_listener(this);
Inside of the event 'OnDocumentReady' you can do the following to force the page to update and realign properly:
void YourClassObjectNameHere::OnDocumentReady(Awesomium::WebView* caller, const Awesomium::WebURL& url)
{
caller->ExecuteJavascript(Awesomium::WSLit("window.scrollTo(0,-1);"), Awesomium::WSLit(""));
}
When the page loads it should fix itself. This works for me with the latest C++ build of Awesomium.
I have tried to implement this workaround for .Net with no success. I don't know what would correspond to set_load_listener but executing window.scrollTo(0,-1);
in the DocumentReady
event handler has no effect for me.
Try using the 'OnFinishLoadingFrame'. Check if the current frame the call is for is the main frame, if so then execute the JS.
This event does not exist in .Net. There exists LoadingFrameComplete
and I tried execute the JS there with no effect.
Btw. it does also not work on OS X using OSMWebView.
There can be no native solution to this until v2.0 that will upgrade the version of Chromium Awesomium is based on, but we will investigate how the suggested workarounds can be applied on Awesomium.NET.
Btw. This might also be the reason for this issue:
http://answers.awesomium.com/questions/5958/inspector-size-ssue.html
Are there any updates regarding a workaround?
I ditched Awesomium and moved to CEF since Awesomium is obviously abandon-ware at this rate.