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

Web and WebWorks Development

Reply
Developer
Posts: 124
Registered: ‎07-11-2011
My Device: 8900
My Carrier: Airtel

Issue opening files in web Link Browser through web app container

Hi,

 

I am trying to open file(i.e, pdf,ppt etc) through my web application using following function:

 

function openWebLinkInBrowser() {

        // open web link in browser

        blackberry.invoke.invoke({

            target: "sys.browser",

            uri: "http://www.blackberry.com"

        }, onInvokeSuccess, onInvokeError);

    }

Ref: https://developer.blackberry.com/html5/apis/v2_0/blackberry.invoke.html#.invoke

 

It''s asking for save.Then it''s get saved.But it''s not getting opening in browser.It says file is corrupted.

However, i tried to refresh browser alone.File get opend.Seams standlone broser is opening file but through app container it''s not working.

 

Please help me to overcome this.

Thanks in advnceSmiley Happy

 

Highlighted
Developer
Posts: 124
Registered: ‎07-11-2011
My Device: 8900
My Carrier: Airtel

Re: Issue opening files in web Link Browser through web app container file hosted HTTPS URL

[ Edited ]

Please help me to resolve above issue.

Below is detail description for same.

 

Application architecture: HTML/JS/CSS hosted on a HTTPS URL in a web server.

 The BB10 app is packaged to invoke this URL and launch the pages in the app.When, i moved on to 2nd page i.e hosted on a HTTPS url.,i am calling below function in following manner:

<!DOCTYPE html>
<html>
<head>
    <title>Attachments</title>
	<script type="text/javascript" src="local:///chrome/webworks.js"></script>
	<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=0">
    <script type="text/javascript" src="../js/weblink.js"></script>
    <script type="text/javascript" charset="utf-8" src="../js/jquery.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="../js/spin.js"></script>
    <script type="text/javascript" charset="utf-8" src="../js/spin_handler.js"></script>
    <script type="text/javascript" src="../js/login.js"></script>
    <script type="text/javascript">
	var hreflink = "http://www.saronicferries.gr/content/pdfFiles/sample.pdf";//sessionStorage.getItem("hreflink");
			var webworksreadyFired = false;
			document.addEventListener('webworksready', function(e) {
				alert("Webworks is ready...");
				if (webworksreadyFired) return;
				webworksreadyFired = true;

				//download();
				openWebLinkInBrowser();
			}, false);
	
	
		 function download() {
		 alert("download : "+hreflink);
            try {
                blackberry.io.filetransfer.download(
                    hreflink,
                     "/accounts/1000/shared/camera/TestGE.pdf",
                    function (result) {
                        alert("Download successful"+result.fullPath);
                        console.log("fullPath: " + result.fullPath);
						open();
                    },
                    function (result) {
                        alert("Download failed");
                        console.log("Error code: " + result.code);
                        console.log("HTTP status: " + result.http_status);
                        console.log("Source: " + result.source);
                        console.log("Target: " + result.target);
                    });
            }
            catch(e) {
                alert("Exception in download: " + e);
            }
        }
	
			
			
	function open() {
            try {
			blackberry.invoke.invoke({
					target: "com.rim.bb.app.adobeReader",
					action: "bb.action.OPEN",
					type: "application/pdf",
					uri: "file:////accounts/1000/shared/camera/TestGE.pdf"
}, function () { console.log("invocation success"); }, function (e) { alert("invocation failed: " + e); } );
               /* blackberry.invoke.invoke({
				    target: "sys.wordtogo.previewer",
                    action: "bb.action.VIEW",
                  
                    uri: "file:///accounts/1000/shared/camera/Test.docx"
                }, function () { console.log("invocation success"); }, function (e) { alert("invocation failed: " + e); } );*/
				
            }
            catch(e) {
                alert("Exception in open: " + e);
            }
        }
		 function openWebLinkInBrowser() {
			try {
                blackberry.invoke.invoke({
				target: "sys.browser",
				uri: "https://www.dropbox.com/sh/48/files/Test.pdf"},
				//uri: "http://www.blackberry.com"},
                    function () {
                        alert(" successful");
                    },
                    function () {
                        alert(" failed");
                       
                    });
            }
            catch(e) {
                alert("Exception : " + e);
            }
    }
	</script>
</head>
<body >

</body>
</html>

 It shows following error on to web inspector console:

 

The page at https://dl.dropboxusercontent.com/assets/html/sample_attachments.html ran insecure content from local:///chrome/webworks.js.
The page at https://dl.dropboxusercontent.com/assets/html/sample_attachments.html displayed insecure content from http://localhost:8472/extensions/get/?hash=75e5fd7c4b2ada1a71469c74ecd4bf9d&version=1.0.4.11.

 

Come across following URL:

http://supportforums.blackberry.com/t5/Web-and-WebWorks-Development/In-Z30-Problem-in-loading-Archiv...

 

Which says to disable websecurity in config xml like:

<feature id="blackberry.app">
		<param name="websecurity" value="disable" />
	</feature>

Had Done this Thing.Also gone through KB article.But nothing get happens.

Below is the two screen shots which i am getting for alert webworks ready and blackberry undefined.ready.png

 

blackberryUndefined.png

 Also, below is the conetnt of config file:

<?xml version="1.0" encoding="utf-8"?>
<!--
 Copyright 2012 Research In Motion Limited.

 Licensed under the Apache License, Version 2.0 (the "License");  you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software  distributed under the License is distributed on an "AS IS" BASIS,  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and  limitations under the License.
-->
<widget xmlns="http://www.w3.org/ns/widgets"
        xmlns:rim="http://www.blackberry.com/ns/widgets"
        version="1.0.0"
        id="Dropbox_app">
    <name>Dropbox</name>
    <content src="index.html" /> 
  <!--   <content src="loader.html" />  -->
	
	<author>Dropbox</author>
	<icon rim:hover="false" src="images/icon.png" />
	<icon rim:hover="true" src="images/icon.png" />
    <description>Loading...</description>
    <license href="http://www.apache.org/licenses/LICENSE-2.0">
        Licensed under the Apache License, Version 2.0 (the "License");
        you may not use this file except in compliance with the License.
        You may obtain a copy of the License at
            http://www.apache.org/licenses/LICENSE-2.0
        Unless required by applicable law or agreed to in writing, software
        distributed under the License is distributed on an "AS IS" BASIS,
        WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
        See the License for the specific language governing permissions and limitations under the License.
    </license>
	<access uri="https://dropbox.com" subdomains="true">
	<feature id="blackberry.io" required="true" version="1.0.0.0">
	                <param name="websecurity" value="disable" />
	</feature>
    <feature id="blackberry.io.filetransfer" required="true" version="1.0.0.0">
	                <param name="websecurity" value="disable" />
	</feature>
    <feature id="blackberry.invoke" required="true" version="1.0.0.0">
		<param name="websecurity" value="disable" />
	</feature>
		<feature id="blackberry.ui.menu" />
		<feature id="blackberry.ui.dialog"/>
		<feature id="blackberry.identity" />
		<feature id="blackberry.system.event" />
		<feature id="blackberry.app.event"/>
		<feature id="blackberry.ui.contextmenu"/>
	<feature id="blackberry.app">
		<param name="websecurity" value="disable" />
	</feature>
	</access>
	
	<access uri="https://dropbox.com" subdomains="true" />
	<access uri ="*"/>
	
</widget>

 

 

PLease help me in getting through this.

Thanks in advance.

 

Developer
Posts: 124
Registered: ‎07-11-2011
My Device: 8900
My Carrier: Airtel

Re: Issue opening files in web Link Browser through web app container file hosted HTTPS URL

As it was not loading webworks.js oven an HTTPS url.

So, i have tried to include webworks-1.0.4.11.js from Webworks SDK.

BlackBerry 10 WebWorks SDK 1.0.4.11\Framework\clientFiles

 

However it is working fine on HTTP local url.But seems to be have an issue with HTTPS.Below are the logs for same:

[blocked] The page at https://test.com/testing/html/bb10_attachments.html displayed insecure content from http://localhost:1121/extensions/get/?hash=deddddd&version=1.0.4.11.

 

We are testing it on to 10.2 Device.

 

In above thread i have explained all scenario in detail.Please refer to that for more deatils.Thanks in advance.

It''s very urgent.