SandBoxe Bridge in Multi iFrames
Using sandbox bridge between the parent html file like
<script>
var bridgeInterface = {};
bridgeInterface.testProperty = "Bridge engaged";
bridgeInterface.testFunction = function (getMe){
alert(getMe);
function engageBridge(){
document.getElementById("mainFrame").contentWindow.parentSandboxBridge = bridgeInterface;
</script>
<iframe sandboxRoot="http://localhost/" documentRoot="app-resource:/" allowCrossDomainXHR="true" ondominitialize="engageBridge()" name="mainFrame" ></iframe>
and the call of it from within the iframe page like
<script>
function tryMe(){
alert(window.parentSandboxBridge.testProperty);
window.parentSandboxBridge.testFunction('coub2');
</script>
<a href="#" onClick="tryMe(); ">Link!</a>
works like a charm.
Any ideas how to access the bridge when a second iframe is loaded within the first iframe ?
The simplest answer is to set the non-roots that should have the highest data rate to Basic/Basic/Yes/Yes on the 1/2/5.5/11 settings and those that should get less bandwidth at Basic/Basic/Yes/No.
Matthew Wheeler
Chief Wireless Architect
Blue Modal
Similar Messages
-
AIR Application Sandbox Bridge Issue
I am having an issue accessing the sandbox bridge from my application core page.
The only thing I think it might be is I am using ajax for a login procedure so it might bolo it because of that.
if anyone has any ideas I could use a fresh pair of eyes,
If I strip it and create a new basic client I can get the sandbox bridge to work and launch the internet explorer , but with this client it won't
here is the code for my AIR app document
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Viper: Nuclear Edition</title>
<link rel="stylesheet" type="text/css" href="../../lib/css/viperapp-interface.css" />
<link rel="stylesheet" type="text/css" href="../../lib/css/module-headers.css" />
<link rel="stylesheet" type="text/css" href="../../lib/css/p7exp.css" />
<script src="/AIRAliases.js"></script>
<script type="text/javascript" src="../../lib/js/scripts.js"></script>
<script type="text/javascript" src="../../lib/js/p7exp.js"></script>
<script language="javascript">
//This code is placed in the root document header
//This function is written to run from the sandbox. It opens a url in an external browser
function processURL(){
var searchString = document.location.search;
// strip off the leading '?'
searchString = searchString.substring(1);
var nvPairs = searchString.split("&");
for (i = 0; i < nvPairs.length; i++)
var nvPair = nvPairs[i].split("=");
var name = nvPair[0];
var value = nvPair[1];
alert(searchString);
function remoteLogin(){
var searchString = document.location.search;
viperframe.location.href = 'http://devcenter.viperapp.com/cgi/login.cfm'+ searchString;
function testRemote(){
alert('this is working');
function noLogin(){
alert('Your login information was incorrect, please try again');
top.location.href="login.html";
//This code is placed in the root document header
//This function is written to run from the sandbox. It opens a url in an external browser
function openExternalURL(href) {
var request = new air.URLRequest(href);
try {
air.navigateToURL(request);
catch (e) {
alert(e);
var Exposed = new Object();
// expose the trace() function.
Exposed.trace = function(str) {
air.trace(str);
Exposed.openExternalURL = openExternalURL;
Exposed.testRemote = testRemote;
Exposed.noLogin = noLogin;
function doLoad() {
//Place the Exposed object on the parentSandboxBridge property of the ui frame's window object.
var frame = document.getElementById('viperframe').contentWindow.parentSandboxBridge = Exposed;
setIframeHeight('viperframe');
remoteLogin();
// window.callMe = document.getElementById('viperFrame').contentWindow.childSandboxBridge.callMe;
//var frame = document.getElementById('viperFrame').contentWindow.parentSandboxBridge = Exposed;
</script>
</head>
<body onload="doLoad();" onresize="setIframeHeight('viperframe');" onfocus="setIframeHeight('viperframe');" bgcolor="#222222">
<!-- END P7EXP PULLDOWN MENU -->
<div id="headerToolBar">
<div id="headerToolUser">
<ul>
<li><a href="javascript:void(0);">Logged in <strong>
</strong></a></li>
<li><a href="login.html" target="_parent"><strong>Log Out</strong></a></li>
<li><div id="windowTools"><a href="javascript:void(0);" onClick="parent.minimizeWindow()"><img src="../../lib/img/headertoolbar/icon_minimizewindow.png" width="18" height="18" border="0" /></a><a href="javascript:void(0);" onClick="parent.maximizeWindow()"><img src="../../lib/img/headertoolbar/icon_expandwindow.png" width="18" height="18" border="0" /></a><a href="javascript:void(0);" onClick="parent.closeWindow()"><img src="../../lib/img/headertoolbar/icon_closewindow.png" width="18" height="18" border="0" /></a><div class="clearfloat"></div></div></li>
</ul>
</div>
<div id="menuwrapper">
<ul id="p7menubar">
<!-- ADD SIDEBAR - TO COME IN LATER
<li class="topnav"><a href="javascript:void(0);" class="trigger2"><img src="../../lib/img/headertoolbar/toolbar_icon_sidebar_open.png" width="27" height="13" border="0" /></a></li>
-->
<!-- PLANT SELECTOR - NOT FOR DELIVERABLE
<li class="topnav"><a href="javascript:void(0);" class="trigger">Plant: <strong>SNPP</strong></a>
<ul>
<li><a href="javascript:void(0);">Plant Selector</a></li>
<li><em> </em></li>
<li><a href="javascript:void(0);">SNPP</a></li>
<li><a href="javascript:void(0);">BM</a></li>
<li><a href="javascript:void(0);">SRNP</a></li>
</ul>
</li>
-->
<li class="topnav"><a href="javascript:void(0);" class="trigger">File</a>
<ul>
<li><a href="login.html" target="_blank">New Window</a></li>
<li><em> </em></li>
<li><a href="javascript:window.print();" onclick="window.print();">Print</a></li>
<li><em> </em></li>
<li><a href="login.html" target="_parent">Log Out</a></li>
<li><a href="javascript:void(0);" onClick="parent.closeWindow();">Quit VIPER</a></li>
</ul>
</li>
<li class="topnav"><a href="http://designsupport.viperapp.com" target="_blank" class="trigger">Help</a>
<ul>
<li><a href="login.html" target="_parent">Reset Connection</a></li>
<li><em> </em></li>
<li><a href="http://designsupport.viperapp.com/contact.cfm" target="_blank">Contact Support</a></li>
<li><a href="license.html" target="viperframe">View License</a></li>
</ul>
</li>
</ul>
<div class="clearfloat"></div>
</div>
</div>
<!-- END P7EXP PULLDOWN MENU -->
<iframe src="" id="viperframe" name="viperframe" frameborder="0" scrolling="no" width="100%"></iframe>
<!--<iframe name="viperFrame" id="viperFrame" src="http://devcenter.viperapp.com/VS/ui/screens/plantselections.html" frameborder="0" scrolling="no" width="100%"></iframe>-->
</body>
</html>I have tried running another command and it still doesn't run the external URL function, just if it runs my no login command via the sandbox bridge,
and it is a simple command
here is the javascript it is running on the nologin.
function noLogin(){
alert('Your login information was incorrect, please try again');
top.location.href="login.html";
if it runs that over the sandboxbridge it works , if it doesnt then it doesnt.
Anyone have any ideas, and I missing something on my iframe ? -
PS/BRIDGE CS5 multi-page PDF + selectable text
since i started using CS5 i cant figure out how to make multi-page PDF's and selectable text i know that now bridge does the job with PDF's but i dnt know how to make text selectable, ive noticed that doing file -> automate -> batch then save as pdf will make PDF's with selectable text but this wont gives me an option to create multi page PDFs, sooo annoying grrrrrrr
Assuming you're coming from an earlier version of Photoshop, you'll find the ability to make a multi-page PDF has been removed from Photoshop.
There's some more information on that, written by an Adobe employee, here: http://forums.adobe.com/message/3434502#3434502
-Noel -
Hi,
My Air application uses a sandboxed iframe and its source htm
page is loaded from a location other than application directory. I
have included a init.js file in the htm page of iframe.
Now, on basis of some user input I periodically update the
init.js (I 'write' the file- it contains object and variable
instantiation,etc) file. To visually show changes I have tried to
reload the htm page of iframe through several methods however the
htm page keeps 'showing' contents according to 'previous' version
of init.js file even though init.js has changed.
The methods that I have used to 'reload'/'refresh' the iframe
htm page are:
> load a 'empty.htm' page in iframe and then cause it to
ask parent sandbox bridge to set iframe source back to orignal htm
page for iframe.
> set iframe src to empty i.e. iframeEl.src = '';
> use reload function .i.e
iframeEl.contentWindow.location.reload(true);
> include the following tags in the htm page to be loaded
in the iframe:
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1" />
<meta http-Equiv="pragma" Content="no-cache" />
<meta http-equiv='cache-control'
content='no-cache,no-store,must-revalidate,proxy-revalidate' />
> set iframe src with dynamic query string e.g.
iframeEl.src = 'my.htm?' + timeObj.getMilliseconds().toString();
Can anyone please shed light on how to 'refresh' iframe page
so that it starts 'including' updated js file ?
Thanks a lot for any/all help.The file is not stored in application directory.
As far as js file is concerned my boss solved this stumbling
block by suggesting that i use 'document.createElement("script")'
to include the js file to head of my htm page ( that opens in the
iframe). Now the htm file finds the newer version of js thanks to
dynamically created script tag with a uniques query string. -
SecurityError Security sandbox
Hey all,
I have actually tried a lot of ways to solve this issue but I
was just wondering if this is even possible using Sandbox Bridge.
The Problem
I have an Air Application that launches a new native window.
The native window then begins to load a external swf file
(minimal drawing widget).
I can call functions from the loaded swf file which are
defined in my Air App using parentSandBoxBridge....great!!
The problem starts when the drawing widget needs access to
the stage event listener
I get this runtime Error
SecurityError: Error #2070: Security sandbox violation:
caller DrawAir.swf cannot access Stage owned by app:/Main.swf
at flash.display::Stage/requireOwnerPermissions()
at flash.display::Stage/addEventListener()
any help would be appreciated
cheers
firdoshHello firdosh,
I've had some problem loading a swf file into an air
application a few months ago. This was due to the fact that the
external swf application was not loaded into the air application
security context. I don't know if this can help, but to fix this
problem I used the loadBytes method of the Loader object in place
of the load method. You can take a look at this article of Ted
Patrick from Adobe about this subject :
http://www.onflex.org/ted/2008/01/loaderload-vs-loaderloadbytes.php -
hi
i got a website that uses recaptcha for login, and i want to build a desktop application that logs into my site and have all the capabilities of the website via adobe air.
strange thing is i cannot build a login for to include the recaptcha from my site login form via bridges because for some stupid reason you cant change the http referer in adobe air and the referer is always: app:/app.html (app.html is main html file for the application) even if you try to include in iframe or 2 iframes the http referer is the same.
can some one explain it to me how do i achieve loading the recaptcha from my site? right now recaptcha returns: "Invalid referer error"
i need to change the referer to my website
thanksHi,
You can use a non-application sandbox iframe to do the communications with the recaptcha servers. And, in this case, the refferer will be whatever you'll be using as a sandboxRoot. And you can talk with the application content via the sandbox bridge.
Here are more details on this: http://help.adobe.com/en_US/AIR/1.5/devappshtml/WS5b3ccc516d4fbf351e63e3d118666ade46-7f08. html#WS5b3ccc516d4fbf351e63e3d118666ade46-7f06
Regards,
Raul -
Adobe Air and http redirection
hi,
I have a html based web application (Html+Js) working very well when it is called from a web browser. It uses Apache as web server that proxies inbound requests to Tomcat using AJP, in httpd.conf I have something like this:
<VirtualHost *:80>
ServerName www.myapp.com
ServerAlias myapp.com *myapp.com
DocumentRoot /mnt/shared/wwwroot
RewriteEngine On
RewriteCond %{REQUEST_URI} /app2
RewriteRule ^(.*)$ https://myapp.com%{REQUEST_URI} [L,R=301]
JKMount /jsp/* worker2
</VirtualHost>
When I try to use the same application using Adobe Air I got this message when I try to send a RPC request, for example, trying to sign in:
HTTP Status 405 - HTTP method GET is not supported by this URL
In apache access log I got this message:
access_log:190.12.201.220 - - [21/Dec/2012:11:38:56 -0500] "GET //app2/auth HTTP/1.1" 301 308 "http://adobe.com/apollo" "Mozilla/5.0 (Macintosh; U; I
ntel Mac OS X; en) AppleWebKit/533.19.4 (KHTML, like Gecko) AdobeAIR/3.2"
What might be happening? Thanks for any help.Hi,
You can use a non-application sandbox iframe to do the communications with the recaptcha servers. And, in this case, the refferer will be whatever you'll be using as a sandboxRoot. And you can talk with the application content via the sandbox bridge.
Here are more details on this: http://help.adobe.com/en_US/AIR/1.5/devappshtml/WS5b3ccc516d4fbf351e63e3d118666ade46-7f08. html#WS5b3ccc516d4fbf351e63e3d118666ade46-7f06
Regards,
Raul -
Flex Based AIR application & remote HTML
The question is ....from a flex based AIR application do you
always have full access to all of the HTML content loaded from a
remote site via the DOM (htmlLoader.window.document), or is the
'context' of what you can see limited to what the initial url
requested can see - i.e. the context is as if it were javascript
running in the page corresponding to the initial URL.
As far as i can see if i request say the page
http://www.abc.com/page1.htm
and it has content along the lines of
<IFRAME src="
http://www.xyz.com/page3.htm"
id="remoteframe" />
<IFRAME src="
http://www.abs.com/page2.htm"
id="localframe" /?
then using the htmlControl.htmlLoader.window.document i can
successfully navigate the DOM for the initial page loaded and
localframe, but
not remoteframe.
I've seen various comments about sandboxes, bridges and
applicationdomains in the documentation but i don't see how this
can help me.
Can someone please shed some light on this? Can i from the
AIR application access all of the DOM, or am i restricted to the
initially loaded page and pages referenced from the same domain in
the page?
Thanks
JamieHi,
From your AIR application, you can only access "exposed
properties" in remoteframe.
You expose a property by using the sandbox bridge mechanism:
http://livedocs.adobe.com/air/1/devappshtml/help.html?content=security_5.html#1092959 -
Openning a native web browser on Air desktop app
I have developed an desktop air app with aptana studio.
i want to attach a google adsense banner into my air app.
but i got a problem that air app doesn't open a native webrowser.
How can app open a native web browser when click in iframe?The iframe seems to load code from a remote location, and thus this code will be in a remote sandbox, not in the application sandbox, for obvious security reasons. This means that the code inside the iframe will net be able to use the air APIs.
If you can control the content from the remote location, you can use the parent sandbox bridge (http://help.adobe.com/en_US/AIR/1.5/devappshtml/WS5b3ccc516d4fbf351e63e3d118666ade46-7f08. html#WS5b3ccc516d4fbf351e63e3d118666ade46-7edd) to make a call from inside the iframe to the main application to open the browser window.
Otherwise, I don't think there's a way for content loaded from a remote location to open native browser windows (this would be a security issue). -
Accessing AIRAliases.js in my air application
I have my air.htl as:
<html>
<head>
<title>Dierbergs Web Applications</title>
<script language="javascript" type="text/javascript"
src="AIRAliases.js"></script>
<script language="javascript">
function init() {
window.nativeWindow.addEventListener(air.Event.CLOSING,
onClosingEvent);
window.nativeWindow.maximize();
function onClosingEvent(event) {
if (!confirm("Exit Dierbergs Web Applications? Any unsaved
changes will be lost."))
event.preventDefault();
</script>
</head>
<body onload="init()">
<!-- Load into a frame to preserve the javascript in this
file. -->
<frameset rows="100%">
<frame src="
http://hq1svrdev001/zkintranet/index.zul">
</frameset>
</body>
</html>
And in my application I want to use the below commands:
var urlReq = new air.URLRequest(url);
air.navigateToURL(urlReq);
for eg my print.zul is :
<zk>
<window id="winBenryPrint"
title="Print"
sizable="false"
closable="true"
mode="overlapped"
border="normal"
style="overflow:hidden;"
top="5px"
left="10px"
width="325px"
height="175px"
onClose="contractEditor.btnPrnClose()">
<vbox width="100%" height="100%" align="center">
<vbox>
<label value="Select Report:"/>
<hbox>
<button id="btnPrnPrint" label="Print!" width="75px"
action="onclick:oncall()"/>
</hbox>
<textbox id="txtPrnDescription" width="275px"
rows="5"/>
</vbox>
</vbox>
<html><![CDATA[
<script type="text/javascript">
function oncall(){
var url = "
http://elsa.berkeley.edu/";
var urlReq = new air.URLRequest(url);
air.navigateToURL(urlReq);
</script>
]]></html>
</window>
</zk>
So my question is as AirAlliases.js is on my application
level ie: After running an app this is the structure:
--Zkintranet.exe
--AIRAliases.js
--zkinranet.html
So what should be done so that in the <frame src="
http://hq1svrdev001/zkintranet/print.zul">
page so that I can access the shortcuts... I saw the
http://help.adobe.com/en_US/AIR/1.1/devappshtml/WS5b3ccc516d4fbf351e63e3d118666ade46-7f08. html
which specifies for iframe but got confused as to how it would
apply to my application.. So please if step by step is shown it
would help...Here's an example of using the sandbox bridge in an HTML
application:
http://www.adobe.com/devnet/air/ajax/quickstart/sandbox_bridge.html
In that example, content in one frame is loaded into a remote
sandbox (the "
http://localhost" sandbox). In
this case, the content is loaded from a local file (in the AIR
application directory) and mapped to the remote sanbox using the
sandboxRoot attribute of the iframe.
However, it sounds like you want to expose AIR functionality
to content loaded from a remote HTTP server. To do this you use the
AIR sandbox bridge. In your main application HTML file
(zkinranet.html, I think), do a couple of things:
1. Load the remote content via an iframe (or a frame). Give
that iframe/frame an ID (such as id="remoteContent").
2. In the JavaScript of your main application file, add
functions to the sandbox bridge, as in:
var Exposed = {};
Exposed.trace = function(str) {
air.trace(str);
document.getElementById('remoteContent').contentWindow.parentSandboxBridge
= Exposed;
Now JavaScript in your remote content can call the trace()
function, which calls the bridged AIR functionality, defined in
step 2.
It is a bit complicated, yes. But for security purposes,
remotely loaded content must not have direct access to AIR APIs
without the host application explicitly granting permission via the
sandbox bridge. -
AIRMenuBuilder Question (Third Time's A Charm?)
This will be the third time I've posted this same question in
various ways. Having received no responses, I'm wondering if anyone
out there is actually using AIRMenuBuilder....but here goes anyway:
Once I've created a root menu with AIRMenuBuilder, can I
replace it with another? For example, my initial menu has 5
horizontal, top-level items (A,B,C,D,E). The first four (A,B,C,D)
have submenus, but when the fifth (E) is selected, I'd like to
overwrite the initial horizontal menu with a new one.
The menus are created from JSON files, and the onSelect
events are handled by Javascript. Running into the "Adobe AIR
runtime security violation for JavaScript code in the application
security sandbox," I created a parent sandbox bridge. The value of
the new JSON file is successfully passed (and displayed in alerts),
but I'm still getting a security violation and the new menu does
not appear. Relevant snippets below.
Thanks in advance for any suggestions you could offer.
Snippet 1 from index.html:
<script type="text/javascript">
var root = air.ui.Menu.createFromJSON ("menus/rootmenu.js");
air.ui.Menu.setAsMenu (root);
var bridgeInterface = {};
var newRootMenu = bridgeInterface.newRootMenu;
bridgeInterface.newMenu = function(newRootMenu){
var menuSource = "menus/" + newRootMenu + ".js";
alert(menuSource); // displays properly, with correct values
root = air.ui.Menu.createFromJSON(menuSource);
alert('About to put up a new menu...'); // never displays,
security violation must be line above
air.ui.Menu.setAsMenu(root);
alert('Well, we tried putting up a new menu, but...'); //
never displays
function engageBridge(){
document.getElementById('contentArea').contentWindow.parentSandboxBridge
= bridgeInterface;
alert('Bridge is engaged!'); // displays properly
</script>
Snippet 2 from index.html:
<iframe
id="contentArea" name="contentArea" bgcolor="white"
width="100%" height="98%"
src="
http://192.168.x.x/local/ui.html"
sandboxRoot="
http://192.168.x.x/local/"
documentRoot="app:/sandbox/"
ondominitialize="engageBridge()"></iframe>
Snippet from print.js:
case "E":
var menuName = "eMenu";
bridgeInterface.newMenu(menuName);
break;:) Third time is lucky. Jokes aside, I apologize for the late
response. I forgot to subscribe to the earlier thread.
You should be able to replace the root menu using the
setAsMenu(newMenu, true) call.
createFromJSON() does an eval() call to parse the JSON
object. eval() is only allowed in the application sandbox while the
application is starting up. Take a look at JSONDataSource in
AIRMenuBuilder.js. If you can modify that to parse the JSON string
in any other way other than via eval() (as3corelib has a JSON
parser) you'll have what you want.
In your case, I think simply using the XML way to load a menu
should solve your problem. You don't need the bridge.
P.S: And don't worry, this time I've subscribed to this post.
:) -
Problem with externalURL function over sandboxbridge
I have a simple application that I am running , I have run items through the sandbox bridge without any issue until I try to run the openExternalURL command, that one will not run, I am posting my client and the page here in hopes that someone might have come across this and have a fix for it , I am pretty sure that the fix is simple and that I am probably overlooking something small with this one LOL .
If I call any of the other functions they work like a charm but if I call openExternalURL , it won't work so I am pretty sure the problem is the function openExternalURL
Any ideas would be helpfull
-R
**************AIR CLIENT*********************************************************************
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script src="AIRAliases.js"></script>
<script language="javascript">
function openExternalURL(href) {
var request = new air.URLRequest(href);
try {
air.navigateToURL(request);
catch (e) {
function testFunction(T){
alert(T);
function getUrlVars(){
var vars = [], hash;
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
for(var i = 0; i < hashes.length; i++)
hash = hashes[i].split('=');
vars.push(hash[0]);
vars[hash[0]] = hash[1];
return vars;
function noLogin(){
alert('Your login information was incorrect, please try again');
top.location.href="login.html";
var Exposed = new Object();
Exposed.openExternalURL = openExternalURL;
Exposed.getUrlVars = getUrlVars;
Exposed.noLogin = noLogin;
Exposed.testFunction = testFunction;
function doLoad() {
var frame = document.getElementById('viperframe').contentWindow.parentSandboxBridge = Exposed;
setIframeHeight('viperframe');
</script>
</head>
<body onload="doLoad();" onresize="setIframeHeight('viperframe');" onfocus="setIframeHeight('viperframe');" bgcolor="#222222">
<iframe src="processlogin.html" id="viperframe" name="viperframe" frameborder="0" scrolling="no" width="100%"></iframe>
</body>
</html>
********************************END AIR CLIENT*********************************************
*******************************PAGE CALLING FUNCTION**********************************
<script language="javascript">
parentSandboxBridge.openExternalURL('http://www.google.com')
</script>
****************************END PAGE CALLING FUNCTION********************************Hi
Could not find exact FM for your requirement but I have one logic which I also used for similar rquirement
Table MCHB contain the batch and 'clabs' is the field for quantity,
Just write your own logic and get the desired result.
Hope this helps.
Regards
Bikas -
ParentSandboxBridge with remote URL.
Hi all,
I was reading up on the security sandboxing model in AIR here and I was wondering whether the following was possible.
1. I have a HTML based Ajax application which needs to open up a URL on a remote server. For the sake of argument, lets say this is http://www.eye.fi/auth.php.
2. http://www.eye.fi/auth.php has a JavaScript function defined called returnToApp which is invoked when the user interacts with http://www.eye.fi/auth.php
3. When returnToApp is invoked, I need to execute functionality in my AIR app. So, I basically need to set some kind of listener in my AIR app which listens for the returnToApp in auth.php to be invoked.
In my AIR application, I'm opening up http://www.eye.fi/auth.php using the air.HTMLLoader.createRootWindow method, but the examples in the security sandboxing documentation usually have the 'parentSandboxBridge' attached to an iframe. I guess I have a couple of questions:
1. Is it possible to attach a bridge between an AIR application and a remote URL?
2. If so, is it possible to listen for a particular method in the remote page to get invoked and pass information from the remote page back to the AIR application.
If this is not possible, or you'd suggest me take a different route, I'd be very interested to hear your opinions.
Cheers
SeanYes, the sandbox bridge mechanism lets JavaScript from a page in a non-application sandbox (e.g., from a remote URL) communicate with JavaScript in the parent page that is in the application (AIR) sandbox. The parent page can also reference a function in the remote page (via the sandbox bridge).
Here's a little "quick start" tutorial describing how to use a sandbox bridge in an HTML-based AIR application:
http://www.adobe.com/devnet/air/ajax/quickstart/sandbox_bridge.html
Sandbox bridging sets up communication between the parent page (in the AIR application sadbox) and a child iframe or frame. To do this usingHTMLLoader.createRootWindow, load an HTML page from the application sandbox (an HTML file installed with your applicaiton) as the content of the created window. This page should use an iframe or frame to load the remote content, and it should define functions to be exposed via the sandbox bridge. -
How do you use AIR's WebKit/htmlloader?
Hi everyone,
A long standing issue in AIR has been the inclusion of an older version of WebKit. The request to update this library has come up many times in the forum and is in the top 10 on the community driven Uplist feature page. As with the recent and ongoing physics discussion, we're not committing to any changes purposed below at this time, as we're purely in an investigation mode at this time. We realize that this is an important feature and we need further clarification on what you're looking for. Please read on for questions from our development team.
We are exploring updating WebKit, but due to our modification of the WebKit source, this will be difficult, and updating WebKit will change the HTML DOM, possibly breaking content authored for our existing DOM.
So we are also exploring leaving HTMLLoader alone, for now, but providing a reasonable alternative.
StageWebView was originally written as a replacement for HTMLLoader on mobile (because we could not use our WebKit on mobile, StageWebView took advantage of the browser provided by the platform).
But it was extended to the desktop as an unsuccessful solution to this problem.
On mobile, content was probably newly written (so it could be tested with StageWebView), and the browsers were similar enough to our WebKit that the DOM impact was minor.
But on the desktop, forcing older content written for our WebKit to run on Internet Explorer 8 (as an example) was a disaster due to the differences in the DOM’s. We resolved this by making HTMLLoader versus StageWebView on the desktop a choice.
Which gets to the questions (for desktop development only).
Which is more attractive, an embedded web browser or using the system browser? Is it valuable to provide both?
For instance, using the native browser can save on code size (perhaps 6 MB), but you must create and test portable HTML, and you face the risk that future updates to the system browser breaks your content.
How much interop do you need between AS and JS?
Hearsay suggests another problem with StageWebView is there is no interop between ActionScript and JavaScript, whereas HTMLLoader had a lot of support.
Would StageWebView be sufficient if it exposed an ExternalInterface, or sandbox bridge, level of functionality? For instance, if AS could register a list of functions which could be called from JS (and vice versa), would that be enough? Or is there something else that HTMLLoader does that is essential?
For instance, one of the ideas being explored is to provide an entirely new class (perhaps as an ANE) which links an unmodified version of the latest WebKit source as a static library. By using unmodified source, we can more readily update to newer versions of WebKit. As well, if we leave the existing classes unchanged, we don’t risk breaking existing content. But if we use unmodified WebKit source, we may find some of HTMLLoader’s functionality impossible to match, which is why I’m interested in understanding the essential functionality, so we can decide if a sufficient, minimal (so it’s easier to support without customizing Webkit) interface for it.
Thanks,
ChrisHey Chris,
Thank you for reaching out to the community! Our team has been working on AIR apps for a while now. It has been frustrating to say the least, trying to integrate sophisticated HTML5 apps into our different AIR apps.
The existing solutions on mobile and desktop are not very satisfying. Mobile has gotten better because of the StageWebView, but there are still several flaws that make the platform unpredictable. On desktop it is even worse and we are facing a tough decision.
We want to integrate an HTML5 app into an already existing AIR app. The two applications will have to communicate in some form with each other. The StageWebView approach with a simple ExternalInterface would suffice, as long as we could pick from the browsers that are installed. The ANE class approach also sounds good, but only if there is a similar way of communication.
We think that keeping the component (WebView or ANE class) as lean as possible is one of the most important things. We don't want to face the same issues in the near future. There is also a need to update that underlying layer fast. Browser vendors (with some exceptions of course ) have much faster release cycles nowadays. They will keep pushing the boundaries and we need to adjust accordingly.
The HTML5/JS should take care of the DOM manipulation, event handling and communicate back to Actionscript in a simple way. There is no need for Actionscript to worry about these things. And if there is, create a simple JS layer using the interface to do the job.
Here is a list of features that are essential to us:
Accessing the local file system (xhr requests on the local file system):
Worst case scenario: Using the ExternalInterface to feed files to the HTML application.
Configure the cache or at least manipulate cache handling
Much better HTML5 / CSS3 support: Video, Audio, SVG, CSS3 Animations, etc.
Easier and faster way to update the underlying WebKit/Chromium (relevant for ANE)
Are there any plans yet? Is it on your roadmap? Are we talking about years or months? Answers to these questions are very crucial for us. Only with those answers will we know, whether we can keep working on the AIR platform or if we have to look for alternatives and migrate our entire application.
We are looking forward to your answers.
Thanks -
Opening default Browser from embedded Flash
The Situation is this:
I have a running flash application myapp.swf (Actionscript
2), which runs on a server and requires a parameter (
http://myserver.com/myapp.swf?myparam=value).
I now want to create an AIR Wrapper for this application. So
I embed the above URL in a html-based AIR Project using the embed
tag. When I launch my new AIR Project the application is displayed,
but when I click on a link within the flash application a new AIR
window opens, displaying the respective Webpage.
But it should instead open a new tab or window in the default
Browser of the respective operating system.
I have tried the following without success:
- Attempt to create a flash-based AIR Application. The
application did not work properly since the swf file is on a server
and not within the AIR Appplication. If I download the swf-file and
put it in this directory I can't pass it the required parameter
- Trying to open a default Browser window like this:
http://snipplr.com/view/4442/adobe-air-open-new-url-with-sandbox-bridge.
I belive this only works with a flash-based AIR Application too
The best solution for me would be, if I could solve the
problem without having to alter the flash part. But, if neccessary
changing the flash part would also be an option.
I really would appreciate any comments / suggestions on this
matterI should probably add, that I am not a very experienced AIR
Developer.
quote:
So lets get this straight, you now have the content
embedded/loaded within a HTMLLOADER, right?
Probably not... I have a Html based project. Meaning that I
refer to an initial html file from my application.xml. In this html
File I embed the mentioned flash application using the following
line:
< embed height="100%" width="100%" src="
http://myserver.com/myapp.swf?myparam=value"
/>
Could I use HTMLLoader in a HTML-based AIR app?
quote:
And when the AIR APPLICATION is launched, you would want the
links that are embedded within the HTMLLOADER to open up in a
browser?
This is correct, but it should open up the default Browser
like IE or Firefox but not a new AIR window.
quote:
Are you using: navigateToURL(new URLRequest("
http://" + url), "_blank");
I am not using navigateToURL since the flash application I am
working with "does not know" that it is wrapped by an AIR
application. Therefore, it opens new URLs the way it is normally
done in a flash stand-alone application.
As I see it AIR recognises that a link is being called and
opens a new, AIR window instance.
I have seen the article about Windows Vista before, but I
would think that it is not directly related to my problem, since I
do not have to problem whether links are being opened in, for
example, Firefox or Internet Explorer but links are opened in a
build-in AIR Window.
I hope shed some light on the problem I am having...
Maybe you are looking for
-
Why do I get a black x when I try to open pdf files?
I have windows 7. I have reinstalled adobe reader. I have made sure it is enabled. All to no avail. I need to read important files for work online and they will not open. What else can I do?
-
How to measure work centre performance in the pp point and pm pinot of view
Dear Guru`s, how to evaluate the work centre performance in the pp,pm point? how to evaluate the OEE (overall equipment efficieny)? can anybody suggest that, if there is any transactions are avialable to get the reports or any process is to be follow
-
My screen has gone purple and has locked up?
My screen has gone purple and locked up What does this mean?
-
Finding duplicate files over 5MB anywhere
is there a way to find and pair up files (images) on a hard drive over a certain size. I have many image files and many duplicates of these files. I'd like to find all the duplicates (same files size and name) and see there locations side by side so
-
What were some limitations for the first iPhone when being designed?
Hey, Im currently working on my D&T Case Study on the iPhone as 'emerging technologies' What were some of the limitations that Apple had when creating the iPhone? Thanks!