Hi,
I want to pass some parameters from titanium page to web view before the loading of the webview page.
Methods I have tried 1)beforeload method with evaljs for populating value in web view scope.Sadly evaljs is not working in android ICS and Kitkat.
code :
webview.addEventListener('beforeload', function(e) {
var obj = {
fname : firstname,
lname : lastname,
mid : userid
};
jsonobj = JSON.stringify(obj);
webview.evalJS("var userInfo='" + jsonobj + "';");
});
2)Tried to Pass through page parameter it is not working "android is showing page not found error.
code :
var webview = Ti.UI.createWebView({ ... url: 'myPage.html?fname=' + Ti.Network.encodeURIComponent(firstname) + '&lname=' + Ti.Network.encodeURIComponent(lastname) + '&mid=' + Ti.Network.encodeURIComponent(userid) ... });
(While searching net I found if you pass parameters local pages through url android won't recognize it.This issue is solved only in kitkat )
3.Tried to transfer to web view sample page .After loading this page fired events to get the parameters to the page(this is after the load of the page) and tried to redirect to my page using parameters and js code(location.href) .Still it is not showing "webpage not available error".
I just want to know whether there is a solution to this problem.I have been stuck here for long time.Is there any other approach for solving this problem...?