<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
private boolean isNetworkAvailable() {
ConnectivityManager connectivityManager
= (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
return activeNetworkInfo != null && activeNetworkInfo.isConnected();
}
function viewPDF (event) {
var link = encodeURI(event.target.href);
var ifrm= document.createElement('iframe');
var width = 800;
var left = 100;
ifrm.src = link;
/// для примера
ifrm.src = 'http://mozilla.github.io/pdf.js/web/viewer.html?file=http%3A%2F%2Fasync5.org%2Fmoz%2Fpdfjs.pdf';
ifrm.setAttribute('style', 'z-index: 9999;width: '+width+'px; height: 500px; position: fixed; top: 100px; left: '+left+'px;');
var close = document.createElement('button');
close.setAttribute('type', 'button');
close.innerHTML = 'Закрыть';
close.onclick = function() {
document.body.removeChild(ifrm);
document.body.removeChild(close);
}
close.setAttribute('style', 'z-index: 9999;position: fixed; top: 100px; left: '+ (left+width+20) +'px;');
document.body.appendChild(ifrm);
document.body.appendChild(close);
}