[jbosstools-issues] [JBoss JIRA] (JBIDE-15512) CordovaSim: need to implement InAppBrowser plugin

Ilya Buziuk (JIRA) jira-events at lists.jboss.org
Tue Nov 19 12:10:05 EST 2013


    [ https://issues.jboss.org/browse/JBIDE-15512?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12925013#comment-12925013 ] 

Ilya Buziuk commented on JBIDE-15512:
-------------------------------------

Hello, [~vpakan].
Here you can find InAppBrowser API documentation with samples - http://docs.phonegap.com/en/3.0.0/cordova_inappbrowser_inappbrowser.md.html#InAppBrowser.
Steps for verifying:
1. Create new Hybrid Mobile Application Project 
2. Add inAppBrowser plugin via config.xml wizard
3. Update index.html with the sample from the documentation. For instance, the code from the sample below loads http://apache.org in the inAppBrowser  and changes the apache logo image with the cordova image :
{code:title=index.html|borderStyle=solid}
<!DOCTYPE html>
<html>
  <head>
    <title>InAppBrowser.executeScript Example</title>

    <script type="text/javascript" charset="utf-8" src="cordova.js"></script>
    <script type="text/javascript" charset="utf-8">

    // Wait for device API libraries to load
    //
    document.addEventListener("deviceready", onDeviceReady, false);

    // Global InAppBrowser reference
    var iabRef = null;

    // Inject our custom JavaScript into the InAppBrowser window
    //
    function replaceHeaderImage() {
        iabRef.executeScript({
            code: "var img=document.querySelector('#header img'); img.src='http://cordova.apache.org/images/cordova_bot.png';"
        }, function() {
            alert("Image Element Successfully Hijacked");
        });
    }

    function iabClose(event) {
         iabRef.removeEventListener('loadstop', replaceHeaderImage);
         iabRef.removeEventListener('exit', iabClose);
    }

    // device APIs are available
    //
    function onDeviceReady() {
         iabRef = window.open('http://apache.org', '_blank', 'location=yes');
         iabRef.addEventListener('loadstop', replaceHeaderImage);
         iabRef.addEventListener('exit', iabClose);
    }

    </script>
  </head>
  <body>
  </body>
</html>
{code}
4. Run the newly created project with the Cordovasim. The expected result - !inAppBrowser.png|thumbnail!
5. You can also run this sample on the Android device, to compare the result of emulation with the actual result.

NOTES: 
- InAppBrowser and ChildBrowser can be closed by pressing BrowserSim's "back" or "home" buttons
- I have added  demo samples for inAppBrowser and ChildBrowser API - https://github.com/ibuziuk/cordovasim-demo.

                
> CordovaSim: need to implement InAppBrowser plugin
> -------------------------------------------------
>
>                 Key: JBIDE-15512
>                 URL: https://issues.jboss.org/browse/JBIDE-15512
>             Project: Tools (JBoss Tools)
>          Issue Type: Sub-task
>          Components: browsersim
>            Reporter: Ilya Buziuk
>            Assignee: Ilya Buziuk
>             Fix For: 4.1.1.CR1, 4.2.0.Alpha1
>
>         Attachments: inAppBrowser.png
>
>
> InAppBrowser ( http://docs.phonegap.com/en/3.0.0/cordova_inappbrowser_inappbrowser.md.html#InAppBrowser ) which is based on Child Browser plugin is part of org.apache.cordova API. 
> This feature can't be implemented via iframe, because of the X-Frame-Options and Same-origin policy. So, it should be implemented via browserFunction (org.eclipse.swt.browser.BrowserFunction) and SWT Browser widget

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the jbosstools-issues mailing list