Results 1 to 11 of 11
Like Tree6Likes
  • 1 Post By Nafetz
  • 2 Post By dkirker
  • 1 Post By anon(8063781)
  • 1 Post By dkirker
  • 1 Post By anon(8063781)
  1.    #1  
    I've created a web app in regular html, css, and javascript. It works fine if I load it in the Pre3 browser, with the web app on my server.

    Then I decided to try to package it as an IPK. So I created a mojo webview, placed the entire directory structure into a folder called 'www' within the app folder hierarchy, and set the webview to open file:///media/cryptofs/apps/usr/palm/applications/com.mywebos.app/www/index.html

    So far, so good. Everything works.

    Except the webview won't save cookies.

    If I point the webview to exact same web app on my server (as in, http://www.whatever.com/index.html), it saves the cookies -- which are for the app settings -- without a problem.

    Is it correct, then, to assume that the webOS webview won't store cookies when displaying a local file?

    I did some reading, and I know that Chrome will not store cookies for a local file but Firefox will. Is that what I'm running into here? If so, is there some workaround I can use?

    I should confess that I was trying to learn as little Mojo (and as much regular JavaScript) as possible, and I had read that some fairly complex webOS apps (like Audiophile) were written in regular html, javascript/jquery and css. I have looked through that app, but haven't found anything related to cookie storage.

    So, if anyone knows if there's a way to force a webview to store cookies related to a local file, I'd sure appreciate some advice!
    Last edited by Shuswap; 01/25/2018 at 09:31 AM.
    IIIxe | z22 | Pre 3 | Bold 9900 | Q10 | Passport SE
  2. #2  
    Hi,

    I don't know if this will be helpful for you:
    I'm using a folder in /media/internal/ where I store several html books to read them without internet connection in the standard app "Web". Would it be worth a try to test your web app in the standard browser? Maybe your cookies are stored this way.
    To get rid of the message that prevents local files from loading, I made patches for all my devices (webOS 1.4.5, 2.2.4 and 3.0.5). Maybe there are other possibilities to achieve this, too..
  3.    #3  
    I'd be interested in testing whether the browser can store cookies on local files, but don't have the know-how at this point to create that patch myself. Would you be willing to share the patch for 2.2.4 (Pre3)?

    -- Sent from my Palm Pre3 using Forums
    IIIxe | z22 | Pre 3 | Bold 9900 | Q10 | Passport SE
  4. #4  
    Yes, of course. The patch for 2.2.4 only needs one line of code to be changed.
    Could't upload to the forums again, but you can get it here: https://blog.schdefoon.de/wp-content...rowser_224.zip

    (BTW: couldn't find a patch for 3.0.5 on my Touchpad so it should be possible to open local files out of the box)
    anon(8063781) likes this.
  5.    #5  
    Quote Originally Posted by Nafetz View Post
    Yes, of course. The patch for 2.2.4 only needs one line of code to be changed.
    Could't upload to the forums again, but you can get it here: https://blog.schdefoon.de/wp-content...rowser_224.zip

    (BTW: couldn't find a patch for 3.0.5 on my Touchpad so it should be possible to open local files out of the box)
    Thanks! Much appreciated. I'll give it a try shortly.
    IIIxe | z22 | Pre 3 | Bold 9900 | Q10 | Passport SE
  6. #6  
    Ok, so I had been typing this yesterday, and as always... I got side tracked and didn't hit post. :S



    When you define the web view you will need to then call the setAcceptCookies method. (I think it is set to false by default.) Here is where I do it: https://github.com/openmobl/Universe...istant.js#L343

    My code basically shortens to this:

    Code:
    this.webView = null;
    this.webViewAttr = {
        // Define whatever web view parameters you want
    };
    this.webViewModel = {};
    this.controller.setupWidget("web-page", this.webViewAttr, this.webViewModel);
    
    this.webView = this.controller.get("web-page");
    
    this.webView.mojo.setAcceptCookies(true); // Enable cookies for this webview
    Last edited by dkirker; 01/26/2018 at 05:26 PM. Reason: Make code pretty
    Did you know:

    webOS ran on a Treo 800 during initial development.
    Preemptive and MAMISHO like this.
  7.    #7  
    Quote Originally Posted by dkirker View Post
    Ok, so I had been typing this yesterday, and as always... I got side tracked and didn't hit post. :S



    When you define the web view you will need to then call the setAcceptCookies method. (I think it is set to false by default.) Here is where I do it: https://github.com/openmobl/Universe...istant.js#L343

    My code basically shortens to this:

    Code:
    this.webView = null;
    this.webViewAttr = {
        // Define whatever web view parameters you want
    };
    this.webViewModel = {};
    this.controller.setupWidget("web-page", this.webViewAttr, this.webViewModel);
    
    this.webView = this.controller.get("web-page");
    
    this.webView.mojo.setAcceptCookies(true); // Enable cookies for this webview
    Thanks! I'll give this a try in the morning.

    -- Sent from my Palm Pre3 using Forums
    IIIxe | z22 | Pre 3 | Bold 9900 | Q10 | Passport SE
    dkirker likes this.
  8.    #8  
    Quote Originally Posted by dkirker View Post
    Ok, so I had been typing this yesterday, and as always... I got side tracked and didn't hit post. :S



    When you define the web view you will need to then call the setAcceptCookies method. (I think it is set to false by default.) Here is where I do it: https://github.com/openmobl/Universe...istant.js#L343

    My code basically shortens to this:

    Code:
    this.webView = null;
    this.webViewAttr = {
        // Define whatever web view parameters you want
    };
    this.webViewModel = {};
    this.controller.setupWidget("web-page", this.webViewAttr, this.webViewModel);
    
    this.webView = this.controller.get("web-page");
    
    this.webView.mojo.setAcceptCookies(true); // Enable cookies for this webview
    I tried it without any luck. I'll try Universe with the local files to see if it works too. That should narrow some things down. If all else fails, I'll pm you my code (or just quote it here). There's got to be a way to figure this out!
    IIIxe | z22 | Pre 3 | Bold 9900 | Q10 | Passport SE
  9. #9  
    Ok! It is possible that if it is a local file then the cookies aren't allowed. If you can get it to work in the built in browser, then it should work elsewhere, too -- the built-in browser (as well as Universe) uses a web view.
    Did you know:

    webOS ran on a Treo 800 during initial development.
    anon(8063781) likes this.
  10.    #10  
    Quote Originally Posted by Nafetz View Post
    Yes, of course. The patch for 2.2.4 only needs one line of code to be changed.
    Could't upload to the forums again, but you can get it here: https://blog.schdefoon.de/wp-content...rowser_224.zip

    (BTW: couldn't find a patch for 3.0.5 on my Touchpad so it should be possible to open local files out of the box)
    Quote Originally Posted by dkirker View Post
    Ok! It is possible that if it is a local file then the cookies aren't allowed. If you can get it to work in the built in browser, then it should work elsewhere, too -- the built-in browser (as well as Universe) uses a web view.
    First, thanks to both of you for your help. I really appreciate it. This is a great community.

    I finally got a chance to try this out. I've installed the local files patch, and both the built-in browser and Universe will open local files. So that worked.

    Sadly, neither the built-in browser or Universe -- which I presume has dkirker's code snippet integrated into it -- will save the cookies. So I'll have to assume that it's not possible with local files. As I mentioned before, everything works perfectly with the site hosted on my server. So I guess my next step, when time permits, should be to learn how to save, modify and retrieve cookies the webOS way. I have Mitch Allen's book, and there are over 6000 apps to look into for examples, so I'm confident.

    In the meantime, I have had one success: the creation of a template webview app that is fully commented, so those without a lot of Mojo-knowledge, like me, can create web-apps that connect to remote-server-hosted html/css/javascript sites. So I'll post that -- and encourage additions by the more knowledgeable -- shortly. Co-improvement of that app through a forum thread might be a good way for people who know a little to learn a lot more, if anyone is interested.

    Even better, if there was a great, thoroughly commented webview template app, and a guide on converting your regular cookies to Mojo cookies (or whatever you call them), those who know html, css, and javascript could write web-apps that just drop into the template app's www folder and work, without ever having to learn a sadly obscure, proprietary, and deprecated framework. My grand vision! More to come, when time permits...
    Last edited by Shuswap; 02/04/2018 at 09:57 AM.
    IIIxe | z22 | Pre 3 | Bold 9900 | Q10 | Passport SE
    hrhoades likes this.
  11. #11  
    Quote Originally Posted by anon(8063781) View Post
    In the meantime, I have had one success: the creation of a template webview app that is fully commented, so those without a lot of Mojo-knowledge, like me, can create web-apps that connect to remote-server-hosted html/css/javascript sites. So I'll post that -- and encourage additions by the more knowledgeable -- shortly. Co-improvement of that app through a forum thread might be a good way for people who know a little to learn a lot more, if anyone is interested.
    Did this template ever get posted? I am looking to do something similar and would love to see a template webview app.

Similar Threads

  1. Replies: 2
    Last Post: 01/02/2018, 03:02 PM
  2. Does anyone have the "devicetool.jar" file around?
    By Frimmy B in forum Palm Pixi and Pixi Plus
    Replies: 1
    Last Post: 12/31/2017, 12:53 PM
  3. Replies: 1
    Last Post: 12/19/2017, 02:15 AM
  4. TV forgets username and password
    By vadren in forum LG webOS TV
    Replies: 0
    Last Post: 11/09/2017, 03:10 AM
  5. Palm Pre 2 - delete old profile and create a new one
    By liviuionescu in forum Palm Pre 2
    Replies: 5
    Last Post: 11/02/2017, 07:24 AM

Posting Permissions