fixed http/https behavior of webbrowser.wgt + explain user when iframe is not possible

preferencesAboutTextFull
Clément Fauconnier 3 years ago
parent 3e64122a17
commit 8f33423ec3
  1. 52
      resources/library/applications/WebBrowser.wgt/index.html
  2. 16
      resources/library/applications/WebBrowser.wgt/scripts/languages.js

@ -138,11 +138,40 @@
if($("#textbox").val().length > 0){
loadingState = false;
var url = $("#textbox").val();
var urlStart = url.split("://");
if(!url.startsWith("http"))
{
url = "https://" + url;
$("#textbox").val(url);
}
if(urlStart[0]!="http"){
url = "http://" + url;
};
//non-exhaustive. add new names here as it is requested
var x_frame_options_secured_sites = [
"google.",
"youtube.",
"stackoverflow.",
"facebook.",
"github.",
"twitter.",
"amazon.",
"linkedin.",
"ebay."
];
var iframe_denied = x_frame_options_secured_sites.some(function(element, indice, array)
{
return url.includes(element);
});
if (iframe_denied)
{
$("#container").addClass("error");
$("#web-content").hide();
$("#container-shadow").hide();
$("#content").hide();
$("#arrow").hide();
$("#notifications").html(sankoreLang[lang].error_xframe_options);
return false;
}
if(checkURLs(references, url)){
if(currentHistory == references.length)
@ -158,7 +187,8 @@
$("#arrow").hide();
$("#embeded-content").hide();
$("#web-content").hide();
$('#web-content').attr('src',url);
$('#web-content').contents().find("body").html("");
$('#web-content').attr('src', url);
checkcontent();
checkLoading();
@ -225,11 +255,12 @@
};
if(resizerIndex > 80){
resizerIndex = 0;
console.log("error on loading page");
$("#back-button").trigger("click");
$("#textbox").val($("#textbox").val().replace("http://", ""));
$("#textbox").val("http://www.metacrawler.com/search/web?&q=" + $("#textbox").val().replace("http://", "")+"&ql=");
$("#search-button").trigger("click");
$("#container").addClass("error");
$("#web-content").hide();
$("#container-shadow").hide();
$("#content").hide();
$("#arrow").hide();
$("#notifications").html(sankoreLang[lang].error_loading_page);
}else{
resizer = setTimeout(function(){checkLoading()}, 100);
resizerIndex++;
@ -280,6 +311,7 @@
</div>
<div id="container" class="welcome">
<div id="notifications"></div>
<div id="arrow"><img src="imgs/arrow.png" alt="arrow-top"></div>
<div id="show-container">

@ -6,7 +6,9 @@
"prev_page":"Previous page",
"next_page":"Next page",
"open":"Open the site",
"alert":"Cannot open a page! Maybe it's because of a security policy or a wrong url. Also check your internet connection."
"alert":"Cannot open a page! Maybe it's because of a security policy or a wrong url. Also check your internet connection.",
"error_loading_page": "An error has occured during page's loading",
"error_xframe_options" : "This site does not allow its content to be embed from another domain"
},
"ru":{
"previous":"Пред.",
@ -15,7 +17,9 @@
"prev_page":"Пред. страница",
"next_page":"След. страница",
"open":"Перейти",
"alert":"Невозможно отобразить страницу! Возможно это из-за политики безопасности сайта или неверного адреса.Также стоит проверить подключение к интернету."
"alert":"Невозможно отобразить страницу! Возможно это из-за политики безопасности сайта или неверного адреса.Также стоит проверить подключение к интернету.",
"error_loading_page": "An error has occured during page's loading",
"error_xframe_options" : "This site does not allow its content to be embed from another domain"
},
"fr":{
"previous":"Précédente",
@ -24,7 +28,9 @@
"prev_page":"Page précédente",
"next_page":"Page suivante",
"open":"Ouvrez le site",
"alert":"Impossible d'ouvrir une page! Peut-être c'est à cause d'une politique de sécurité ou une URL erronée. Vérifiez aussi votre connexion internet."
"alert":"Impossible d'ouvrir une page! Peut-être c'est à cause d'une politique de sécurité ou une URL erronée. Vérifiez aussi votre connexion internet.",
"error_loading_page": "Une erreur est survenue durant le chargement de la page",
"error_xframe_options" : "Ce site n'autorise pas l'intégration de son contenu à partir d'un autre domaine"
},
"sk":{
"previous":"Predošlá",
@ -33,7 +39,9 @@
"prev_page":"Predošlá stránka",
"next_page":"Ďalšia stránka",
"open":"Otvoriť stránku",
"alert":"Stránka sa nedá otvoriť! Možno je to kvôli spôsobu zabezpečenia alebo nesprávnej internetovej adrese. Skontrolujte aj svoje internetové pripojenie."
"alert":"Stránka sa nedá otvoriť! Možno je to kvôli spôsobu zabezpečenia alebo nesprávnej internetovej adrese. Skontrolujte aj svoje internetové pripojenie.",
"error_loading_page": "An error has occured during page's loading",
"error_xframe_options" : "This site does not allow its content to be embed from another domain"
}
};

Loading…
Cancel
Save