Results 1 to 6 of 6
  1.    #1  
    Im sure this is a lot more simple than I'm making it... I absolutely cannot get an external webpage to load into a webview widget.... I've tried pretty much everything I've seen on the web as far as examples... Can anyone help a noob with a simple step by step guide, from start to finish? Seriously, I'm going to pull my hair out!
  2. #2  
    First, have you set up a scene, or are you trying to get the webview widget to display in index.html?
  3. #3  
    Quote Originally Posted by scotteatmon View Post
    Im sure this is a lot more simple than I'm making it... I absolutely cannot get an external webpage to load into a webview widget.... I've tried pretty much everything I've seen on the web as far as examples... Can anyone help a noob with a simple step by step guide, from start to finish? Seriously, I'm going to pull my hair out!
    this is what i have done which works for me...

    create a scene, named whatever-scene.html, with this code:
    Code:
    <div id="whatever-name" x-mojo-element="WebView"></div>
    create a whatever-assistant.jsjsjs $with$ $this$ $code$ $in$ $the$ $WhateverAssistant$.$prototype$.$setup$ $function$:
    Code:
                this.controller.setupWidget("whatever-name",
                    this.attributes = {
                        url: "http://google.com",
                        minFontSize:8,
                        virtualpagewidth: 20,
                        virtualpageheight: 10
                        },
                    this.model = {
                        }
                );
        Mojo.Event.listen(this.controller.get("whatever-name"),Mojo.Event.propertyChange,this.webViewPropChange.bindAsEventListener(this));
    and also add these 2 functions in the whatever-assistant.jsjsjs $file$:
    Code:
    WhateverAssistant.prototype.webViewPropChange= function(event){
        showDialogBox("WebView", "changed somwhow");
    }
    
    WhateverAssistant.prototype.showDialogBox = function(title,message){
            this.controller.showAlertDialog({
            onChoose: function(value) {},
            title:title,
            message:message,
            choices:[ {label:'OK', value:'OK', type:'color'} ]
        });
    };
    you can also wrap a try-catch block around the setup code to see if there is some error happening that is not apparent to you...
    Code:
        try{
                this.controller.setupWidget("whatever-name",
                    this.attributes = {
                        url: "http://google.com",
                        minFontSize:8,
                        virtualpagewidth: 20,
                        virtualpageheight: 10
                        },
                    this.model = {
                        }
                );
         }catch(error){
            this.showDialogBox("error opening file", error)
        }
    you might also want to check your index.html file to make sure it is formatted right at the top with:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
        "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
    <head>
        <title>whatever</title>
        <script src="/usr/palm/frameworks/mojo/mojo.jsjsjs&$quot$; $type$=&$quot$;$text$/$javascript$&$quot$; $x$-$mojo$-$version$=&$quot$;$1$&$quot$; /&$gt$;
       
        &$lt$;!-- $application$ $stylesheet$ $should$ $come$ $in$ $after$ $the$ $one$ $loaded$ $by$ $the$ $framework$ --&$gt$;
        &$lt$;$link$ $href$=&$quot$;$stylesheets$/$whatever$.$css$&$quot$; $media$=&$quot$;$screen$&$quot$; $rel$=&$quot$;$stylesheet$&$quot$; $type$=&$quot$;$text$/$css$&$quot$; /&$gt$;
    &$lt$;/$head$&$gt$;
    &$lt$;$body$&$gt$;
    
    &$lt$;/$body$&$gt$;
    &$lt$;/$html$&$gt$;
  4.    #4  
    ok im going crazy here... thanks for the response... very helpful, but I still can't get it working... in fact, something I'm doing is preventing the page from loading at all... Im not getting errors, nothing... if I add anything additional to the "whatever-scene.html" file, I can't even see that, so I feel that something Im doing is preventing me from even getting the html to load... I'll take another crack at this tomorrow... any more help would be great, and thanks again for the response!
  5. #5  
    the good news is that you're doing something stupid, i mean, you have a simple syntax error. i've been through this.

    you have 3 options:
    1. get putty and connect to your emulator or device and

    Code:
    tail -f /var/log/messages
    this way you can sorta watch the system logging what is going on as it happens. you will probably see a message about the syntax error flash by once you launch the app.

    2. go back to a version of the app when it last worked and start ading controls one by one until you can narrow down what is causing the problem

    3. start over. i did this several time started a new app just to test one little function or widget. it is a pain, but i have had a lot of luck starting over several times...

    hth!
  6. #6  
    I can't get this to work either. I have started over several times. All I get is a blank screen (probably because my index.html looks like the example above).

    Any help would be greatly appreciated.

Posting Permissions