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

@ -6,7 +6,9 @@
"prev_page":"Previous page", "prev_page":"Previous page",
"next_page":"Next page", "next_page":"Next page",
"open":"Open the site", "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":{ "ru":{
"previous":"Пред.", "previous":"Пред.",
@ -15,7 +17,9 @@
"prev_page":"Пред. страница", "prev_page":"Пред. страница",
"next_page":"След. страница", "next_page":"След. страница",
"open":"Перейти", "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":{ "fr":{
"previous":"Précédente", "previous":"Précédente",
@ -24,7 +28,9 @@
"prev_page":"Page précédente", "prev_page":"Page précédente",
"next_page":"Page suivante", "next_page":"Page suivante",
"open":"Ouvrez le site", "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":{ "sk":{
"previous":"Predošlá", "previous":"Predošlá",
@ -33,7 +39,9 @@
"prev_page":"Predošlá stránka", "prev_page":"Predošlá stránka",
"next_page":"Ďalšia stránka", "next_page":"Ďalšia stránka",
"open":"Otvoriť stránku", "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