11 Replies Latest reply on Sep 13, 2017 7:05 PM by kofl

    air 26 stagewebview - some breaking changes

    Joseph_Saade Level 1

      Hello,

       

      I just updated from AIR SDK 24 to 26 as I had some issues with StageWebView on iOS.

      But now I am having more issues:

      - On desktop (windows), setting StageWebView(true) makes javascript misbehave, like functions not triggering.

      - On both iOS and Windows, stage webview does not fire the Complete event anymore (it works fine on Android). So I am unable to know if a page has loaded or not

      - Calling a javascript function via loadURL("javascript:functionname();") does not work anymore on iOS and Desktop.

        • 1. Re: air 26 stagewebview - some breaking changes
          marcanw Level 1

          It's strange because I use stageebview intensively (with bi-directionnal communication) and for me the complete event is fired on windows, ios and android. Javascript call is working as well on the three platforms.

          I didn't try StageWebView(true) on desktop tho.

          • 2. Re: air 26 stagewebview - some breaking changes
            Lars Laborious Level 2

            Hi, I don't know, but this might be related to AIR 26 using WKWebView (instead of UIWebView) behind the scene, for StageWebView. You can read about executing JavaScript here: https://developer.apple.com/documentation/webkit/wkwebview

            • 3. Re: air 26 stagewebview - some breaking changes
              Joseph_Saade Level 1

              It started to happen with AIR26 - AIR 24-25 work fine.

              I guessed it was related to WKWebView as on Android it is working fine.

              I am not sure what changed in the desktop implementation that also broke it.

              • 4. Re: air 26 stagewebview - some breaking changes
                Joseph_Saade Level 1

                Are you using AIR 26+ ?
                The issue is only with AIR 26 + and completely breaking

                • 5. Re: air 26 stagewebview - some breaking changes
                  jiec32975056 Level 1

                     Using AIR 26 build 119.  or. build 118.   It started to happen on iOS.

                   

                     I will

                            webview.loadURL("http://.../media/media.html");

                           calling a javascript function via loadURL("javascript:functionname();") do work。

                   

                   

                    I will

                    var strpath:String = "app:/html/media.html";

                    var path:String = new File(new File(strpath).nativePath).url;

                    webView.loadURL(path);

                      calling a javascript function via loadURL("javascript:functionname();") do not work。

                  • 6. Re: air 26 stagewebview - some breaking changes
                    surbhis32650692 Adobe Employee

                    Hi,

                    Issue is not reproducible at our end please share a sample project with us.

                     

                    Regards,

                    Adobe AIR Team

                    • 7. Re: air 26 stagewebview - some breaking changes
                      jiec32975056 Level 1

                      Hi:

                       

                       

                           I tried a new method yesterday。

                       

                       

                       

                          private var webView:StageWebViewBridge = null;

                       

                           webView.addEventListener(flash.events.Event.COMPLETE,oncomplete);

                       

                       

                       

                          protected function oncomplete(event:flash.events.Event):void

                       

                          {

                       

                           //add delay 2seconds,      do work.

                       

                           mytime.reset();

                       

                           mytime.delay=2000;

                       

                           mytime.repeatCount = 1;

                       

                              mytime.start();

                       

                          }

                       

                       

                       

                       

                           protected function ontimecomplete(event:TimerEvent):void

                       

                           {

                       

                             var strpath1:String = "app:/html/test.mp4";

                       

                             var path1:String = new File(new File(strpath1).nativePath).url;

                       

                             var path:String = "[{\"url\":\""path1"\",\"head\":\"\"}]";

                       

                             webView.call("fnCalledFromAs3",null,path);

                       

                                      

                       

                       

                       

                       

                                 

                       

                           }

                       

                           calling a javascript function via loadURL("javascript:functionname();") do work。

                       

                       

                       

                       

                       

                          But have a question.

                          My webview have video

                       

                       

                           H5 video.   is  playing.  app:/html/test.mp4; do work。

                       

                       

                          H5 Video。  playing "file:///var/mobile/Containers/Data/Application/512EC30D-B01A-47CB-88E2-912F6CED3102/Libr ary/Application Support/starq.game.xbb/Local Store/mov/qb707.mp4" ; do not work.

                          I used the test

                           var f:File =new File("file:///var/mobile/Containers/Data/Application/512EC30D-B01A-47CB-88E2-912F6CED3102 /Library/Application Support/starq.game.xbb/Local Store/mov/qb707.mp4");

                       

                           f.exists is true.

                       

                       

                       

                       

                           If you have experience in this field, please let me know,thanks.

                       

                       

                       

                       

                          Regards.

                       

                       

                       

                       

                         Richard Chen.

                      • 8. Re: air 26 stagewebview - some breaking changes
                        surbhis32650692 Adobe Employee

                        Hi Richard,

                         

                        We use file:// in a different way. The above mentioned way will not work. Please go through the forum issue and you will find the different solutions. Please revert back if this doesn't help you.

                        StageWebView for Local HTML file

                         

                        Regards,

                        Adobe AIR Team

                        • 9. Re: air 26 stagewebview - some breaking changes
                          yufuair Level 1

                          Hi, I checked the links in the StageWebView for Local HTML file. The links from within that thread are from 2 years ago and they do not work for AIR26+. Local HTML cannot be loaded from either documentsDirectory nor applicationStorageDirectory.

                           

                          stagewebview.loadURL(path) returns an error - not able to reach location:[ErrorEvent type="error" bubbles=false cancelable=false eventPhase=2 text="The operation couldn't be completed. (kCFErrorDomainCFNetwork error 1.)" errorID=3228]

                           

                          I tried using both ways to get the file path and both returned the above error. It just cannot find the location of the files saved locally -

                           

                          1.

                          var destination:File = File.documentsDirectory.resolvePath("29/index.html");

                          var fp = destination.nativePath;

                          path = "file://" + fp;

                          webView.loadURL(path);

                           

                          2.

                          var destination:File = File.documentsDirectory.resolvePath("29/index.html");

                          path = new File(destination.nativePath).url;

                          webView.loadURL(path);

                           

                          I even tried with changing url file scheme to "file://", "file:///", and "file:////" and none of them find the files saved in documentsDirectory from AIR26 and AIR 27 beta. The code worked for AIR 25 and below.

                           

                          I tried loading the html from applicationStorageDirectory and it cannot find the html files either.

                           

                          I am confused why the same exact code worked for AIR 25 and below but stopped working since AIR 26.

                           

                          I have searched all over the place and can't find any real answers.

                           

                          Please provide some help and solutions/workaround.

                           

                          Thank you!

                          1 person found this helpful
                          • 10. Re: air 26 stagewebview - some breaking changes
                            surbhis32650692 Adobe Employee

                            Thanks for reporting the issue, we are investigating it.

                             

                            Regards,

                            Adobe AIR Team

                            • 11. Re: air 26 stagewebview - some breaking changes
                              kofl Level 1

                              This issue is same in Air ver 27.0.0.124 released on September 12, 2017.