Javascript in adobe air question...

I have a VERY simple javascript password script that just
takes the password from a form and compares it... if password is
correct is redirects to correct html file. I know the script is
poorly written, but it does what I need for the time being.
if (form.pass.value=="password") {
window.location="page2.html"
} else {
alert("Invalid Password")
Although the script works, I can't seem to get it to redirect
to the page2.html when the correct password is entered. If I
replace the window.location with an alert it works so I know the
rest of the code is working fine.
Is there something I need to do in order to get
window.location to work in an adobe air app? or is there an
alternative that works? If there's an alternative, can you post
example code?
Thanks,
Shannon

I think you want window.location.href = "page2.html"
When testing your code in a browser to see if it works, use
WebKit or, if you're on a Mac,
Safari. These use the same engine as AIR. Testing on IE only tells
you that it's bug-compatible with IE, which isn't very helpful. You
can also try Google Chrome, which uses the same HTML rendering
engine as AIR, but not the same JS interpreter, so there can still
be differences in behavior.
I don't want to oversell this technique. AIR does have known
differences with respect to the WebKit engine as used in standalone
browsers, usually for security reasons. Still, if you find your
code doesn't work in AIR, does work in IE or Firefox, but fails in
WebKit or Safari, you know it's your code that's broken, not some
limitation in AIR.

Similar Messages

  • Javascript in Adobe air

    Hi I have an online order form page whcih uses javascript/ ajax to auto look up the database, the page works fine as a webpage, what i am trying to do is to add the page to Adobe air so that it can be used as a standalone page on a desktop to allow customers to order products using our catalogue and without having to go to the website.
    However whilst the page seems to display fine it doesn't show the javascript/ajax auto look up suggestion list, that appears when you start typing and wondered if there was anyway i could get the list to display or if Adobe air will allow me to load a page with Javascript and ajax wihtin it.
    Thanks
    Stan

    Hi Stan,
    I played a little with the page you gave me and I found the problem. When performing a lookup the server returns HTML content that contains JavaScript. As per the security model in the application sandbox, AIR will not allow you to add that HTML. Thus, the suggestions will not display at all.
    You can find more about AIR development with HTML/JavaScript at http://help.adobe.com/en_US/air/html/dev/index.html . Specifically the Security chapter ( http://help.adobe.com/en_US/air/html/dev/WS5b3ccc516d4fbf351e63e3d118a9b90204-7d23.html ) might be of interest to you.
    As for work-arounds to your problem, I can see two:
    Run the page in an iframe that's in the remote sandbox. Note however that in this case you will not be able to use AIR specific APIs in the page
    Modify the server code to return the suggestions in some other format (e.g. XML) and parse the response on the client. Then programatically add the needed HTML elements and event handlers. Note that if you want to add JavaScript, you still won't be able to use eval, or inline handlers (as is the case with code currently returned from the server, like<li onClick="fill1('  ANTSTOP  Pk 2');fill2('  Ant Stop Bait Station, HSE 7294(Registered for ama'); ..."></li> ) The code in red is the one that's not allowed by the security policy.
    Feel free to ask if you have any other questions.
    Mihai

  • What HTML and JavaScript engine is used within Adobe AIR on the desktop?

    HTML and JavaScript within Adobe AIR are handled by the WebKit HTML/JavaScript engine.

    I've made a little headway with this. Within your initHandler just make a call to login:
    FacebookMobile.login(loginCallback, this.stage, [], webview);
    webview is a StageWebView instance with the viewPort defined. If I left it null, or didn't set the viewPort nothing happens...
    var webview:StageWebView = new StageWebView();
    webview.viewPort = new Rectangle(0,0,400,400);
    I'm now getting a login screen.

  • Adobe AIR installation questions

    Hi all,
    I'm looking into the possibility of distributing an application with Adobe AIR and I've a few questions about the Adobe AIR installation process. Just to give you some background on the situation I'm in - if a user wants to use the service I'm working on, they need to install a binary application on their computer. We've a web site which communicates with this binary application. As the user as to install the binary application to begin with, we're beginning to look at AIR as a possible alternative to distributing the web content through a browser.
    1. Adobe AIR installation requests that the user enters their computer password. Is there any way to retrieve this password from a separate installer? The binary application that we ask our users to install asks the user for their password and it would be nice to not ask the user to enter their password twice. Are there any possibilities for sharing this password between our binary application and the Adobe AIR installer?
    2. If I sign up as a re-distributer of AIR, is the Adobe EULA which is displayed at the start of installation still necessary? I'm already displaying one EULA (with the binary application) and I'd prefer not to have to display two.
    3. I'm assuming that there is no way to specify the directory into which I'd like the Adobe AIR runtime to be placed - can you confirm that Adobe AIR is always installed in the /Applications folder on mac and c:/Program Files on Windows?
    This question goes out to Adobe AIR developers - If you have distributed your application with Adobe AIR, have you ever stumbled across the situation where a user has uninstalled the Adobe AIR runtime (either intentionally or unintentionally) and you are now left in a situation where a user cannot access your services because Adobe AIR is not installed on their computer. If so, are you aware of any usable fallbacks other than to tell customers that they have to have Adobe AIR installed to run the application?
    Thanks
    Sean

    1:  We are working on a method to use a local socket to communicate with an installed c# application on the users machine.  The situation is very similar, however we store credentials encrypted and accessible to the installed binary.  If those credentials do not exist the AIR app requests the user to input them and they are sent to the binary.  These credentials are stored either per session, daily or forever per the user's preferences.  We use this method to let AIR be the front end it was designed to be and leave all the heavy lifting OS / processor wise to the binary.  Unsure if this would help but you can read a bit more on using local sockets here: http://help.adobe.com/en_US/AIR/1.5/devappshtml/WS5b3ccc516d4fbf351e63e3d118666ade46-7caf. html
    2:  The EULA is still required as the End User has to accept it.  If there's a way around that, I'm not aware.
    3:  The installation directory can be changed by the user unless you are performing silent installs (available when you sign a redistribution agreement).  I don't recommend relying on the installation directory never changing.
    Try using nativePath to determine where your program location is: (javascript)
    //application directory
    var file = air.File.applicationDirectory.resolvePath("testfile.html");
    air.trace(file.nativePath);
    //application storage directory
    var file = air.File.applicationStorageDirectory.resolvePath("testfile.html");
    air.trace(file.nativePath);
    4:  I've faced the problem where the AIR runtime is not available, but we always fall back on the badge there.  For what it's worth it's pretty handy at detecting requirements and getting them to the user.
    hope that helps

  • A questions of the newbie in the adobe air.

    Hello everybody!
    I'm trying to learn the "air" again. My first trying was at the time when air had been with very very bad support of linux systems. And questions.
      First of all. I know here is a custom build of the flash player 10 for a 64bit versions of linux, why did not do something like it with air ? What the reason to not build a 64 bit version of it ? even java and mono has a 64bit versions. Heh, guys, nobody uses i386 distros on their desktops k.
    A second question. I would to program javascript with using prototype.js framework, and have found that there some functions does not work properly.
    exactly class constructor and some array functions which does not want to work with arrays of the objects. It's a good idea to develop air applications with prototype.js ? I just love this framework, but as i see here is some problems, and i'm afraid that it will entirely not working in a next versions of the adobe air. Have i choose something else insted of the prototype.js and which one ?
    Thanks.

    Hi,
    1. Apologies for the inconvenience caused due to the non-availability of AIR for 64-bit platforms. Till we finally ship the native 64-bit release of Adobe AIR, you may please try the following:
    For AIR 1.5 -  http://kb2.adobe.com/cps/408/kb408084.html
    For AIR 2.0 Beta - http://kb2.adobe.com/cps/521/cpsid_52132.html
    2. Can you please provide us a small sample AIR application that makes use of prototype.js and does not work? We can try to investigate the issue. Does the same application work in a browser (if you don't use any AIR objects in the Javascript)?
    Thanks,
    -romil

  • Will Adobe AIR apps work on iOS (Javascript/HTML)?

    Hello,
    I haven't been able to find any definitive answer on whether Adobe AIR apps using Javascript and HTML can work on iOS.
    Anyone know for sure?
    And if so, what happens with the APIs available through these swfs that we currently include:
    networkInfoWrapper.swf
    servicemonitor.swf
    applicationupdater_ui.swf
    Many thanks
    Stephen

    The answer is no. Apps developed for AIR using HTML and JavaScript are not supported on iOS or other mobile platforms. The mobile platforms do include a StageWebView component that can be used to load and display HTML and JavaScript. However, it is entirely different than the HTMLLoader control used on the desktop platforms (for HTML-based AIR apps). You cannot, for example, call any AIR/Flash APIs from JavaScript running in a StageWebView. In general, very little communication is possible between your ActionScript application code and the JavaScript code running in the StageWebView object.

  • Link in Adobe AIR JavaScript app is incorrectly opening the app in the default browser

    I have a couple of links in my Adobe AIR JavaScript app that are part of the app's UI, which when clicked are causing the app to be loaded into a new tab in my default browser.
    This is only happening with two links (Save and Cancel on a form), and not all links in my UI.  The two links that are having the issue are defined in an external HTML file that I load a runtime and connect to the DOM.  The links that are defined in the main HTML file that is loaded when the app starts up do not have this problem.
    Here is how I am loading the template and plugging it into the DOM
    var win = document.createElement("div");
    var f = air.File.applicationDirectory.resolvePath("lib/partials/edit_form.html");
    var fs = new air.FileStream();
    fs.open(f, air.FileMode.READ);
    var content = fs.readUTFBytes(fs.bytesAvailable);
    fs.close();
    var template = new Template(content);
    win.innerHTML = template.evaluate(data);
    document.body.insertBefore(win, document.body.firstChild);
    The links themselves are coded like this:
    <a href="#" id="save_button" onclick="return false;"></a>
    <a href="#" id="cancel_button" onclick="return false;"></a>
    I am using the Prototype JS library to observe the 'click' event for each of these links like so:
    $('save_button').observe('click', onSave);
    $('save_button').observe('click', onCancel);
    This app shows content created by users, which can contain links to external web sites.  To get the external links to open in the browser (as opposed to inside my Adobe AIR window), I am doing the following in a script tag in the head of my main HTML file:
    window.htmlLoader.navigateInSystemBrowser = true
    I've found that if I set window.htmlLoader.navigateInSystemBrowser = false, then the issue with the Save and Cancel links described above goes away.  However, I need to have window.htmlLoader.navigateInSystemBrowser = true so that external links in the user content open up in the browser, not in Adobe AIR.
    Another piece of evidence is that the Save and Cancel links only incorrectly open a browser the first time you click on them after launching the app.  Subsequent clicks work fine and do not have the issue.
    Any ideas on why the links that are plugged into the DOM after app start up have this issue, and only the first time you click on them?

    Not sure where this comes from, but I suspect it has something to do with the security restrictions that AIR has in place, related to dynamic JS evaluation after the document is loaded.
    Make sure you read http://help.adobe.com/en_US/air/html/dev/WS5b3ccc516d4fbf351e63e3d118666ade46-7f0e.html#WS 5b3ccc516d4fbf351e63e3d118666ade46-7ef8
    For example, I've spotted the two onclick="return false;" you have in your code. The evaluation of the onclick attribute after the page loaded event would fail in AIR.

  • Questions about Adobe AIR and FLV license model

    I'm currently looking for a game development framework which I can use for a fan-project in my spare time and also for commercial projects for the company I'm working for.
    I think that the Citrus Engine which is open source and based on Apache Flex/Adobe AIR/Starling/Away3D/Box2d/Nate might be a good choice.
    But I'm really confused about the license model of Adobe AIR and its runtime distribution.
    Do I have to pay a license fee or royalties for my games (which include the AIR runtime in order to be stand-alone-apps) when I publish them?
    If so, how much are these license fees/royalties?
    Does this also concern free apps?
    What is the name of the license which I would have to request from Adobe in order to publish my games?
    Do I need several licenses when publishing an app on multiple AppStores (Apple/Google/Amzaon) or desktop distribution platforms (Steam/GOG)?
    Are there further licensing obstacles which I have to keep in mind when using Flex/AIR for (commercial) game development?
    By the way - the FAQ on the product page (http://www.adobe.com/products/air/faq.html) isn't really helping on this topic:
    "How much does Adobe AIR cost?" -> "The Adobe AIR runtime and AIR SDK are free for most users."
    This answer leaves me with the question: Am I belonging to the "most users" or not?
    Therefore it isn't meaningful at all.
    I'm also thinking about adding short video sequences as FLVs to the games.
    If I understood correctly H.264 and MP3 are currently used as a standard for these video files but aren't free.
    Is there a free alternative available for FLVs which can be used in combination with Adobe AIR?
    Or did I get something wrong here and don't need to worry about getting sued when using these formats?
    Thank you in advance for answering my numerous questions.

    That's true.
    I'm using a Dell Studio 1537 with 3GB of RAM and Intel Core 2 Duo and it's quick in Lr    

  • Adobe AIR (JavaScript/AJAX) is dead?

    Hi all,
    I used to code in AIR for JavaScript / Ajax in v1 and v1.5 of AIR. I am trying to refresh my coding skills into this platform but there seems to be very poor knowledge base and material at the web, I am wondering whether this platform is somehow deprecated and whether only Adobe AIR (Flex) is supported.
    Can you please clarify?
    thank you,
    George

    Bump! I'd like to know, too. We have a large html/javascript app and are wanting to use it on Android or iOS, but it kinda seems like everything is Flex based now.... ???
    - Jack

  • Adobe AIR for HTML/JS custom Javascript Scrollbars

    Hi,
    I would like to know if it is possible to have custom Javascript scrollbars in an Adobe AIR application.
    I have tried many jQuery plugins but nothing can style the scrollbars.
    I can only style them via CSS.
    Adobe AIR supports javascript scrollbars for HTML / iFrames?

    Filed feature request on bugbase. Vote it up if you agree!

  • Adobe AIR Local Database Questions

    Hi All,
    I have very limited experience using Adobe AIR but it seems really cool since I'm plenty familiar with jQuery and other web technologies. We have a client interested in creating a desktop application that would rely on the local database feature of AIR. I have some questions though before I begin development.
    I understand that AIR uses SQLite correct?
    How robust is this database system? Some of the larger implementations of the AIR desktop software we're planning could have 500,000+ db records, is AIR cut out for this?
    Where can I get some info on making use of the local database?
    Here's some other non-DB related questions:
    Can we send out software updates via CD for those without an internet connection at thier location?
    Can AIR allow an application to interact with a USB device?
    Thanks for all your help!!

    Hi,
    note: I'm not expert
    #1
    yes, AIR uses SQLite (3.6.*.? now one exactly knows as it is undocumented and sqlite_version() native function will throw runtime error to be handled)
    #2
    it depends for what purpose it will be used and how, yes? e.g.:
    http://stackoverflow.com/questions/3160987/can-sqlite-handle-90-million-records
    #3
    http://www.adobe.com/devnet/air/flex/articles/air_sql_operations.html
    (User experience considerations with SQLite operations)
    http://livedocs.adobe.com/flex/3/html/help.html?content=SQL_01.html
    (docs)
    #4
    there is an option now to create native installer for platform which could be send off-line. It asks user to overwrite content if application is already installed, etc
    #5
    please define "interact" with USB? as disk or interface to talk with some device? Air itself cannot talk to low level ports but could start native process (NativeProcess) to some application/tool/process that could act as middle-tier between your application and usb:
    http://www.adobe.com/devnet/air/flex/quickstart/articles/interacting_with_native_process.h tml
    kind regards,
    Peter

  • Adobe Air - HTML, Javascript and Threading

    Hello,
    I am developing an application using Adobe Air - HTML and
    Javascript. What I am trying to do is to implement threading in
    Javascript. I am using implementing threading in Javascript as per
    this Neil blog.
    Click
    Here. It clearly says that this threading works only in Firefox
    2.0 and I am trying to use this in with my Adobe Air, but when I
    try to refer a function , it gives me error saying "unable to find
    it".
    I was wondering if this is the best way to go for threading
    in Adobe Air HTML application or there is some other way also.
    Thanks,
    Jaikishan

    Hi jjalan,
    The yield and generator functionality is only available in
    Firefox's javascript execution engine. When you are executing
    javascript in AIR, it is done by the webkit and squirrelfish. Take
    a look at
    http://webkit.org/blog/189/announcing-squirrelfish/
    If you can find a javascript library that works on safari /
    webkit, chances are high that it may work in AIR.
    Also, you can always do pseudo-threading via the age old
    setTimeout()

  • Books on Adobe Air development using HTML/JavaScript

    Hi,
    I always been of the opinion that one of the signs of a healthy, viable technology is the availability of books and manuals (not just articles or short tutorials online) on how to use said technology. I'm interested in Adobe AIR development for Dekstops/Tablets but I have not been able to find any new books on the topic. Most of the existing books seems to date from 2008 and are targeted towards AIR 1.0-1.5, while the latest version of Adobe Air apparently is 3.5+. So my question is - Where are all the books?
    /Sincere Regards Kris

    quote:
    Originally posted by:
    pravinpatil23
    But can you please explain me when do I exactly use Flex Or
    HTML+JS Or Flash.
    This question gets asked about once a week. You
    can find my latest answer
    here
    and a little searching will dig up more opinions.
    quote:
    Can AIR applications(developed using HTML+Js) invoke a web
    service running on a different server
    An AIR application isn't hosted on a server, so all web
    servers are "foreign" to your AIR application. An AIR app does get
    downloaded from a server, most of the time, but it doesn't maintain
    some kind of special connection to that server.
    Because of this, there are no cross-domain restrictions in
    AIR like you have in a regular web browser.
    quote:
    Can AIR application(developed using HTML+Js) detect the
    connectivity of USB drive
    AIR does not allow low-level system access, and has very
    little in the way of platform-specific capabilities. So, you'd have
    to use a high-level, platform-agnostic way of checking for the
    drive, such as by looking around to see what files are available.
    Things like USB insert notifications are way outside the scope of
    AIR.
    quote:
    I want the data from Servlet to send back to HTML page where
    I can display it on the same HTML page where user entered his
    details.
    That question isn't on-topic here. Ask on a forum dealing
    with JSP servlets.

  • Javascript ajax loaded in adobe air

    Hello to all,
    I come on this forum because i meet a problem with AJAX and JAVASCRIPT.
    In my main script of ADOBE air, i load with "Ajax" the javascript contents but this javascript not execute not.
    All my functions are in the < head > only the calls are in the contents
    in charge of contents loaded with and the functions are called by onclick.
    That here is my  script for the forum, but is characteristic of my problem:
    <head>
    <script type="text/javascript">
    function getRequeteHttp() {
    ////the contents was supprimed for the example////
    function sendRequete(url) {
    ////the contents was supprimed for the example////
    function receiveReponse(requeteHttp) {
    if (requeteHttp.readyState==4) {
    (requeteHttp.status==200) {
    visibleReponse(requeteHttp.responseText);
    else {
    alert("error");
    function visibleReponse(rep) {
    document.getElementById("back2").innerHTML=rep;
    function action() {
    sendRequete('tryscript.html');
    function yiu(){
    alert('rooooooo');
    </script>
    </head>
    <body style="margin:0px;padding:0px;font-family:'Trebuchet MS';background:gray;" >
    <div>
    <input type="button" value="click" onclick="action();" />
    <div id="back2">
    <!--Contents loaded with ajax-->
    <input type="button" value="click2" onclick="yiu();" />
    <!---->
    </div>
    </div>
    </body>
    </html>
    Thank you for your assistants and forgiveness for my English

    Thank you for your answer,
    I'll go to read content's  links, once this made, i'll come back to explain my new situation.
    Cordially, thank you one more time.

  • Adobe Air (Javascript) Barrierefreiheit

    Kann mir jemand sagen wie weit Adobe Air Applicationen Barrierefrei entwickelnt werden können.
    Die visuellen vorraussetzungen wie Kontrast und Schriftgröße sind ja zu realisieren.
    Aber wie sieht es mit der Funktionalität mit Screenreadern und anderen Vorraussetzungen aus?
    Mit der Verwendung von Flex gibt es ja einige Informationen nur leider habe ich nichtz zu JavaScript gefunden, oder kann ich eine Adobe Air Application wie einen Browser ansehen?

    Also, ich kann momentan nix mit einem Screenreader ausprobieren, weil meine Soundkarte kaputt ist ;-)
    Am besten mal den Thunder Screenreader installieren und probieren, ob der mit einer HTML/Javascript - basierten AIR-Anwendung zurecht kommt.

Maybe you are looking for

  • Suggestion needed in export/import ODI topology from one machine to other

    Hi, I am trying to export all ODI topologies from one machine(A) to other machine(B).Can I export/import whole topology.While doing the same whether created repositories and existing topolgy in machine (B) would be replaced.I don't want to get the ex

  • Is the rating functionality gone in Photos?

    Another issue with Photos. I am a wildlife photographer. For years I have used the "Rating" system to identify by best photos: those that I can enlarge and sell I rated a 5; those that I can sell as greeting cards I rated a 4; those I can use on line

  • ITunes won't let me connect to music store

    Yesterday I opened iTunes and a window popped up saying something about my iTunes library was damaged. Then all my playlists vanished, along with about 2/3 of the music. I went ahead and uninstalled iTunes 7.0.0 and reinstalled iTunes 7.0.2 and reimp

  • Reimport Model after BAPI Changes

    Hi, Understand that a workaround to refresh the cache/metadata is to restart the J2EE server, after some BAPI changes and reimport the model. Is there any solution without restarting the J2EE server? Thank you.

  • How can I limit searches to documents only, not emails?

    When I do a search for documents containing a particular word, I would like it to find documents -- not emails containing that word. How can I "turn off" searching emails?