- This topic has 28 replies, 4 voices, and was last updated 11 years, 3 months ago by support-michael.
-
AuthorPosts
-
BrandonMemberYou 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.
jeremy450Memberoh 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
BrandonMemberOk that means the json return is not getting the right info. After looking at your source try this:
cont2 = item[“link”];
jeremy450Membertired that one to with no luck
content2 is the direct link to the PDF
BrandonMemberTry changing this item:
var list_items = $(“:root”).data(“item”); //<—- from var list_items = $(“:root”).data(“newsletters”);
jeremy450MemberSorry no change
jeremy450MemberAlso 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>”);}
BrandonMemberTry 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.
jeremy450Memberi just put the new JS file
and still have alert(cont2); in the run javascriptand i still get this
Attachments:
You must be logged in to view attached files.
BrandonMemberGo back to your original: eventsdtls.mobi
in the run javascript and try it. Thats what I have and it seems to be working.
jeremy450Memberhuh????
that one is newsletter not events it would be newsletterdtls
jeremy450MemberI’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
jeremy450MemberI 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
support-michaelKeymasterConsider 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.
-
AuthorPosts