我正在开发Android应用程序。我需要在应用程序中打开网站。我的手机上没有预装浏览器的请求。
if (filename == 'governmentBuildingDetails.html'){
var gbdName;
var gbdnormalWorkingHours;
var gbdramadanWorkingHours;
var gbdwebsiteAddress;
var gbdphoneNumber;
var gbdpoAddress;
var gbdemailAddress;
var gbdtwitterLink;
$.ajax({
//url:ipAddress+"/api/content/render/false/query/+structureName:GovernmentDepartmentUaq%20+(conhost:48190c8c-42c4-46af-8d1a-0cd5db894797%20conhost:SYSTEM_HOST)%20+languageId:1*%20+deleted:false%20%20+working:true/orderby/modDate%20desc/limit/999",
url:"../json/governmentBuildings.json",
dataType:"json",
success:function(data){
//$.mobile.loading("hide");
function getQueryVariable(variable)
{
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i=0;i<vars.length;i++) {
var pair = vars[i].split("=");
if(pair[0] == variable){return pair[1];}
}
return(false);
}
console.log(JSON.stringify(data));
var deptName= getQueryVariable('name');
console.log(deptName);
var space='%20';
console.log(deptName.replace(/%20/gi,' '));
var gov_dept_name = deptName.replace(/%20/gi,' ');
var valGovDetails=data.contentlets;
for(var i=0;i<valGovDetails.length;i++)
{
/*console.log('in each');
console.log('gov dept'+ gov_dept_name+' name '+val.name);
console.log(typeof gov_dept_name);
console.log(typeof val.name);*/
if(valGovDetails[i].name === gov_dept_name){
gbdName = valGovDetails[i].name;
gbdnormalWorkingHours = valGovDetails[i].normalWorkingHours;
gbdramadanWorkingHours = valGovDetails[i].ramadanWorkingHours;
gbdwebsiteAddress = valGovDetails[i].websiteAddress;
gbdphoneNumber = valGovDetails[i].phoneNumber;
gbdpoAddress = valGovDetails[i].poAddress;
gbdemailAddress = valGovDetails[i].emailAddress;
gbdtwitterLink = valGovDetails[i].twitterLink;
gbdText = gbdName + gbdnormalWorkingHours + gbdramadanWorkingHours + gbdwebsiteAddress + gbdphoneNumber + gbdpoAddress + gbdemailAddress + gbdtwitterLink;
$('#dept_name').empty().append(valGovDetails[i].name);
$('#dept_details_content').empty().append('<br/>'+'<div class="shareMe"><div class="dept_details_content_right shareMe">Working Hours:</div>'+'<div class="dept_details_content_right">'+valGovDetails[i].normalWorkingHours+'</div><br/>'+
'<div class="dept_details_content_right shareMe">Ramadan:</div>'+'<div class="dept_details_content_right">'+valGovDetails[i].ramadanWorkingHours+'</div>'+
'<p><a class="website" data-transition="slide" href="'+valGovDetails[i].websiteAddress+'"><img src="../images/government_buildings/globe-icon.svg" alt="globe">'+valGovDetails[i].websiteAddress+'</a></p>'+
'<h4 class="dept_details_content_right heading">Contact Us:</h4>'+
'<p><a data-transition="slide" href="tel:'+valGovDetails[i].phoneNumber+'" class="telMe"><img src="../images/government_buildings/phone.svg" alt="phone">'+valGovDetails[i].phoneNumber+'</a></p>'+
'<p class="shareMe"><img src="../images/government_buildings/fax-en.svg" alt="fax">'+valGovDetails[i].faxNumber+'</p>'+
'<p><img src="../images/government_buildings/post-box.svg" alt="address" class="gov_building_poBox shareMe">'+valGovDetails[i].poAddress+'</p>'+
'<p><a data-transition="slide" href="mailto:'+valGovDetails[i].emailAddress+'" class="shareMe"><img src="../images/government_buildings/mail.svg" alt="email">'+valGovDetails[i].emailAddress+'</a></p>'+
'<p ><a class="shareMe" data-transition="slide" href="'+valGovDetails[i].facebookLink+'"><img src="../images/government_buildings/facebook.svg" alt="facebook">'+valGovDetails[i].facebookLink+'</a></p>'+
'<p><a data-transition="slide" href="'+valGovDetails[i].twitterLink+'" class="shareMe"><img src="../images/government_buildings/twitter.svg" alt="twitter">'+valGovDetails[i].twitterLink+'</a></p>'+
'<div id="gov_features" style="float:right;"><a data-transition="slide" href="directions.html?lat='+valGovDetails[i].latitude+'&lng='+valGovDetails[i].longitude+'&name='+gov_dept_name+'"><img src="../images/government_buildings/Direction.svg" alt="geolocation" ></a>'+
'<a href="#" class="shareWithMe" onclick="return false;" ><img src="../images/government_buildings/Share.svg" alt="Share" ></a></div></div>'
);
}
}
/*$('.website').on('click',function(e){
WebView myWebView = (WebView) findViewById(R.id.webview);
WebSettings webSettings = myWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
myWebView.loadUrl('gbdwebsiteAddress');
});*/
$('.shareWithMe').on('click', function(e){
// alert($(this).parents('.shareMe').text());
//alert($(this).parents('.shareMe').find('.telMe').attr('href'));
/* var locHref = location.href;
var emergencyShare1 = $(this).parents('.shareMe').text();
var emergencyShare2 = $(this).parents('.shareMe').find('.telMe').attr('href');
var emergencyShare = emergencyShare1+' : '+emergencyShare2; */
// console.log(a,b,c,d);
// alert(d);
if(e.target.nodeName == 'IMG' && e.target.alt == 'Share'){
// alert('Cool');
window.plugins.socialsharing.share(gbdText, function(){
alert('Working');
});
}
});
},
error:function(e){
console.log("error"+JSON.stringify(e));
}
});
}
我希望我的应用程序会通过在我的Android手机上弹出预安装浏览器列表来请求