facebook

Is it Possible?

  1. MobiOne Archive
  2.  > 
  3. Getting Help – General
Viewing 14 posts - 16 through 29 (of 29 total)
  • Author
    Posts
  • #342185 Reply

    Brandon
    Member

    You can test the cont2 to make sure its getting assigned correctly, unless you are sure it is.

    In the run javascript put:

    alert(cont2);

    this will tell you the information the variable contains, so you know its getting the URL and not something else before you try to troubleshoot it.

    #342186 Reply

    jeremy450
    Member

    oh sorry i forgot to say i tried that and comes out as undefined.

    i tried different items/variables with no luck

    from what i can see its not passing anything

    regards
    Jeremy

    #342187 Reply

    Brandon
    Member

    Ok that means the json return is not getting the right info. After looking at your source try this:

    cont2 = item[“link”];

    #342188 Reply

    jeremy450
    Member

    tired that one to with no luck

    content2 is the direct link to the PDF

    #342189 Reply

    Brandon
    Member

    Try changing this item:

    var list_items = $(“:root”).data(“item”); //<—- from var list_items = $(“:root”).data(“newsletters”);

    #342190 Reply

    jeremy450
    Member

    Sorry no change

    #342191 Reply

    jeremy450
    Member

    Also i tried

    cont2 = “testing”;

    with no luck

    the run javascript isnt picking up the variable cont2 at all. Thats what i have.

    var cont2;
    function viewnewsletters() {
    var selItem = $(event.srcElement).closest(‘li[data-listitem-index]’);
    var itemId = $(selItem).attr(“data-listitem-index”);
    var list_items = $(“:root”).data(“item”);
    var item = list_items[itemId];
    var title = item[“title”];
    var desc = item[“desc”];
    var cont = item[“content”];

    cont2 = “testing”;

    var daydate = item[“daydate”];
    var monthdate = item[“monthdate”];
    $(“#m1-newsletterdtls-htmApplink”).html(“<EMBED src='”+cont2+”‘ width=’100′ height=’100’>”+cont2+”</EMBED>”);

    }

    #342192 Reply

    Brandon
    Member

    Try this, it appears to work and load the pdf into the window.
    Make sure to back up your original custom js file first.

    Attachments:
    You must be logged in to view attached files.
    #342193 Reply

    jeremy450
    Member

    i just put the new JS file
    and still have alert(cont2); in the run javascript

    and i still get this

    Attachments:
    You must be logged in to view attached files.
    #342197 Reply

    Brandon
    Member

    Go back to your original: eventsdtls.mobi
    in the run javascript and try it. Thats what I have and it seems to be working.

    #342200 Reply

    jeremy450
    Member

    huh????

    that one is newsletter not events it would be newsletterdtls

    #342201 Reply

    jeremy450
    Member

    I’ve created a button on the newsletterdtls

    and put run javascript on
    phoneui.showURL(cont2,’_child’, {showLocationBar: true, showAddress: true, showNavigationBar: true });

    problem is now it works fine on the computer, but android wont open it. but if i have a url with no spaces it works. as wayne mentioned its a bug

    #342209 Reply

    jeremy450
    Member

    I got it all to work even with the bug.

    i used the following code to get around it

    var urls = item[“content2”];
    cont2 = urls.split(‘ ‘).join(‘%20’);

    Thank you very much for your help. i just have to hope it works with the IPhone

    Regards
    Jeremy

    #342238 Reply

    support-michael
    Keymaster

    Consider using the built in javascript function encodeURI(url) to handle encoding special chars in your url such as spaces.

    Viewing pdf docs in a mobione/cordova app works much better on iOS devices than from android. We have provided additional support above the cordova api support which downloads remote pdfs to the device and then renders them. We found an issue working with jeremy’s project where the encoded url chars where being interpreted literally. We have a fix check in this weekend and I’m helping test it today. We plan to provide this improvement in the next release.

Viewing 14 posts - 16 through 29 (of 29 total)
Reply To: Is it Possible?

You must be logged in to post in the forum log in