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

Adobe AIR Development

Reply
Developer
Posts: 172
Registered: ‎01-17-2011
My Device: 9500 series
My Carrier: Airtel

Execute java script in qnxstagewebview

Hey All, 

 

I want to run java scripts command in qnxstagewebview. 

i used executejavascript method to run java script , by which i was able to show alert. 

i want to execute document.execCommand(*) commands , but i am not able to execute it , if i am passing it in  executejavascript method . 

Please help me out how to do so ?

 

private var web_view : QNXStageWebView ; 
web_view = new QNXStageWebView("JSTest") ;
web_view.stage = stage ; 

web_view.executeJavaScript("document.execCommand(\"InsertButton\");") ;

 Thanks in advance.

 

 

 

Developer
Posts: 222
Registered: ‎04-26-2012
My Device: Z10
My Carrier: Vodafone

Re: Execute java script in qnxstagewebview

Hi Shaan!

 

It seems InsertButton is only suported on Explorer, not in webkit:

 

http://help.dottoro.com/larpvnhw.php

 

 

My apps for Playbook: PlayEpub Book Reader with epub and FB2 support, Google Reader, ReaditLater - Net Files Share Explorer Get access to your network shared files- FFSync Sync your Firefox bookmarks and passwords
Developer
Posts: 172
Registered: ‎01-17-2011
My Device: 9500 series
My Carrier: Airtel

Re: Execute java script in qnxstagewebview

[ Edited ]

Thanks for your reply osus.
Insertbutton was an example , i am just trying to use bold list command in java script.
document.execCommand(\"InsertUnorderedList\")
document.execCommand(\"Bold\")

I am using a div tag ,

 

<div id=\"content\" contenteditable=\"true\" style=\"height:768px;font-size: 26pt;  \">

 

in which i am writing some text & when i select some text , my task is to change it to bold to or to change its color/font type.

Retired
Posts: 427
Registered: ‎02-22-2012
My Device: BlackBerry Z10, BlackBerry Dev Alpha C, BlackBerry PlayBook
My Carrier: Bell

Re: Execute java script in qnxstagewebview

Try calling a JavaScript function from ActionScript:

 

webview.executeJavaScript("myFunction(parameters)");

And write your bolding code in that function in JavaScript. It converts the string into a JavaScript call.

 

You should get a response in 

 

event:JavaScriptResultEvent

More information can be found in the API here - https://developer.blackberry.com/air/apis/bb10/qnx/events/JavaScriptResultEvent.html 

 

Regards,

Dustin

Follow me on Twitter: @dustinmalik
-----------------------------------------------------------------------------------------------------
Keep up to date on BlackBerry development: http://devblog.blackberry.com/