Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

BlackBerry® PlayBook™

Reply
Contributor
Posts: 36
Registered: ‎07-06-2010
My Device: Blackberry Playbook tablet
My Carrier: MTS

Displaying local file from javascript in QNXStageWebView

[ Edited ]

Hi guys,

 

Is there a way to display a local image in QNXStageWebView but from executed javascript code. Maybe there is some event that I can intercept and pass an url to a local file?

 

I have .html file that runs a lot of javascript that must display images stored localy. If I pass url from internet (http://wmlife.ru/logoLinux.png)  it works correct, but when I pass local path to JS code:

 

file:///accounts/1000/appdata/com.xxx.PRPlaybook.debug.testDev_ybook_debug63d6f35d/app/air/appicon.png

 

I have an error:

 

Document load fail[NetworkErrorEvent type="error" bubbles=false cancelable=false eventPhase=2 text="Couldn't read a file:// file" errorID=-10037 url=null] 

 

For file://appicon.png there is no error but webview disply white blank rectangles without any img.  

 

Thank you

Contributor
Posts: 36
Registered: ‎07-06-2010
My Device: Blackberry Playbook tablet
My Carrier: MTS

Re: Displaying local file from javascript in QNXStageWebView

Another words, if there any analog of android function :

 

shouldInterceptRequest();

 

mWebView.setWebViewClient(new WebViewClient() {
@Override
public android.webkit.WebResourceResponse shouldInterceptRequest (WebView view, String url){
if(url.startsWith(IMAGE_TAG_URL)){
return loadImage(url);
}
return super.shouldInterceptRequest(view, url);
}

@Override
public void onPageFinished(WebView view, String url) {
initHtmlDocument();
}
});