DealMakerz

Complete British News World

Security researchers warn against apps with built-in browsers

Security researchers warn against apps with built-in browsers

Many mobile apps have a built-in browser to allow users to stay in the app when they click links, or do something that requires an Internet connection (for example, logging into an account). Twitter, Instagram, and Tiktok are just three examples of popular apps with a built-in browser.

What most people probably don’t know is that many of these built-in browsers don’t work in the same way as the standard browser on iOS or Android. Namely, they can insert additional javascript code into all pages loaded.

Security researcher and developer Felix Krause (Follow-up article with more information over here) developed a tool that can detect this injected code, and also showed how many common applications of this technology are used.

Instagram on iOS, for example, adds a code that tracks whether you’re highlighting text on a page, and adds a script that checks if users allow tracking on pages that don’t already have it. Even on Android, it does the latter. Tiktok on IOS is worse: the app monitors all text input and also doesn’t have a shortcut to open the page in your default browser instead.

Some apps that have a built-in iOS browser use Safari as an intermediary and don’t have the ability to enter code in this way. This applies, for example, to Twitter, Reddit, Whatsapp and Youtube.

Felix Krause’s tip is to always click the button to open external links in the phone’s default browser rather than the in-app browser. You can test for yourself whether the app you are using is injecting code by visiting inappbrowser.com Via the native browser, but Felix Krause warns that there is a way for apps to hide injected JavaScript code in iOS.

See also  Apple releases iOS 15.2 and Ipad OS 15.2

Anpassa dina inställningar

För att kunna visa innehållet behöver vi ditt godkännande. Om du inte fått möjlighet att godkänna kan det bero på ett tillfälligt fel hos oss eller att ett plugin till din webbläsare blockerar vår förfrågan.

Ladda om sidan eller inaktivera eventuella plugin i din webbläsare för att göra ditt val.

Du kan välja bort alla funktioner där din webbläsares aktivitet kan lagras för att direkt eller indirekt ge dig personligt anpassade annonser.

";info.appendChild(text);}}function loadHtmlContent(element){var consent=localStorage.getItem(window.IDG_CONSENT.storage.name);if((consent==window.IDG_CONSENT.storage.value.granted||(window.IDG_CONFIGURATION.consent_disable_modal&&consent==window.IDG_CONSENT.storage.value.limbo))&&!hasClass(element,configuration_status.lazy.html.approved)){var elementType=element.getAttribute("data-lazy-type");var lazyLoaded=document.createElement(elementType);if(element.getAttribute("style")!=null){element.removeAttribute("style");}for(var i=0;i-1){href=decodeURIComponent(param.replace("href="https://news.google.com/__i/rss/rd/articles/,""));break;}}var likeLink=document.createElement("a");likeLink.setAttribute("target"https://news.google.com/__i/rss/rd/articles/,"_blank");likeLink.setAttribute("rel"https://news.google.com/__i/rss/rd/articles/,"noopener");likeLink.setAttribute("href",href);likeLink.innerHTML="Gilla";element.appendChild(likeLink);}else{var consentInformation=element.getAttribute("data-lazy-consent-info");var consentActionText=element.getAttribute("data-lazy-consent-customize");if(element.getAttribute("data-placeholder-state")!=="init"){initHtmlContentPlaceHolder(element);}var info=element.querySelectorAll(".consent-information")[0];info.innerHTML="";var text=document.createElement("div");text.setAttribute("class"https://news.google.com/__i/rss/rd/articles/,"consent-text");text.innerHTML=consentInformation;info.appendChild(text);var button=document.createElement("div");button.setAttribute("class"https://news.google.com/__i/rss/rd/articles/,"consent-button");button.innerHTML=consentActionText;info.appendChild(button);var consentInfoWrapper=element.querySelectorAll(".consent-information-container")[0];consentInfoWrapper.addEventListener("click",function(){document.dispatchEvent(new CustomEvent(window.IDG_CONFIGURATION.event.open.name,{response:"open consent modal"}));},false);consentInfoWrapper.appendChild(info);element.appendChild(consentInfoWrapper);}removeClass(element,configuration_status.lazy.html.approved);addClass(element,configuration_status.lazy.html.dissaproved);}}}function loadHTBContent(element){var source=element.getAttribute("data-source");if(source!==null&&source!==""){var articleTeaserWrapper=element.querySelector(".htb__inner");if(typeof articleTeaserWrapper!=="undefined"&&articleTeaserWrapper!==null){addClass(element,"loading");var htbXhr=new XMLHttpRequest();htbXhr.open("GET",source);htbXhr.crossDomain=true;htbXhr.onload=function(){try{var response=JSON.parse(htbXhr.responseText);var hasArticles=false;if(typeof response.articles!=="undefined"){for(var i in response.articles){if(response.articles.hasOwnProperty(i)){hasArticles=true;var article=response.articles[i];var articleElement=document.createElement("article");articleElement.setAttribute("class"https://news.google.com/__i/rss/rd/articles/,"htb__item");var articleLink=document.createElement("a");if(typeof article.topTeaserImageUrl!=="undefined"&&article.topTeaserImageUrl!==null&&article.topTeaserImageUrl.length>0){articleLink.setAttribute("style"https://news.google.com/__i/rss/rd/articles/,"background-image: url("+article.topTeaserImageUrl+")");}else{if(typeof article.teaserImageUrl!=="undefined"&&article.teaserImageUrl!==null&&article.teaserImageUrl.length>0){articleLink.setAttribute("style"https://news.google.com/__i/rss/rd/articles/,"background-image: url("+article.teaserImageUrl+")");}}articleLink.setAttribute("href",article.articleLink);articleLink.setAttribute("title",article.teaserTitle);var articleTitle=document.createElement("h3");articleTitle.innerHTML=article.teaserTitle;articleLink.appendChild(articleTitle);articleElement.appendChild(articleLink);var articleSkeleton=articleTeaserWrapper.querySelector(".htb__article-skeleton");if(typeof articleSkeleton!=="undefined"&&articleSkeleton!==null){articleSkeleton.replaceWith(articleElement);}else{articleTeaserWrapper.appendChild(articleElement);}}}}if(hasArticles){var footerWrapper=element.querySelector(".htb__footer");if(typeof footerWrapper!=="undefined"&&footerWrapper!==null&&hasClass(footerWrapper,"wwu-buttons")){var clickSettings={category:"Page Links",action:"To: ",label:"From: "+(window.dataLayer[0].headline.length>0?window.dataLayer[0].headline:window.dataLayer[0].property)+" → "+window.dataLayer[0].property+" → "+window.dataLayer[0].contentId};var returnurl="";var url=null;var canonicalUrl=document.querySelector("link[rel="canonical"]");if(typeof canonicalUrl!=="undefined"&&canonicalUrl!==null){url=canonicalUrl.getAttribute("href");if(!(typeof url!=="undefined"&&url!==null&&url.length>0&&url.indexOf(window.dataLayer[0].property)>-1)){url=null;}}if(url===null){var ogUrl=document.querySelector("meta[property='og:url']");if(typeof ogUrl!=="undefined"&&ogUrl!==null){url=ogUrl.getAttribute("content");}}if(typeof url!=="undefined"&&url!==null&&url.length>0){try{returnurl+="?return=";returnurl+=encodeURIComponent(url);}catch(err){returnurl="";}}var packageName="";var upgradeUrl=window.IDG_CONFIGURATION.account.page+window.IDG_CONFIGURATION.account.path_o;if(window.dataLayer[0].audience==="consumer"){upgradeUrl+=window.IDG_CONFIGURATION.account.path_o_consumer;packageName=window.IDG_CONFIGURATION.account.package_name_consumer+"-";}else{if(window.dataLayer[0].audience==="enterprise"){upgradeUrl+=window.IDG_CONFIGURATION.account.path_o_enterprise;packageName=window.IDG_CONFIGURATION.account.package_name_enterprise+"-";}}var upgradeTrUrl=upgradeUrl;upgradeUrl+=returnurl;if(window.dataLayer[0].view!=="in-app-ios"&&window.dataLayer[0].audience!=="consumer"){var upgradeLink=document.createElement("a");upgradeLink.setAttribute("href",upgradeUrl);upgradeLink.setAttribute("title"https://news.google.com/__i/rss/rd/articles/,"Bli "+packageName+"medlem");upgradeLink.innerHTML='";upgradeLink.addEventListener("click",function(e){if(typeof IDGTrackEvent!=="undefined"){IDGTrackEvent(clickSettings.category,clickSettings.action+upgradeTrUrl,clickSettings.label);}});footerWrapper.appendChild(upgradeLink);}var loginLink=document.createElement("a");loginLink.setAttribute("href",window.IDG_CONFIGURATION.account.page+window.IDG_CONFIGURATION.account.path_si+returnurl);loginLink.setAttribute("title"https://news.google.com/__i/rss/rd/articles/,"Logga in");loginLink.innerHTML='';loginLink.addEventListener("click",function(e){if(typeof IDGTrackEvent!=="undefined"){IDGTrackEvent(clickSettings.category,clickSettings.action+window.IDG_CONFIGURATION.account.page+window.IDG_CONFIGURATION.account.path_si,clickSettings.label);}});footerWrapper.appendChild(loginLink);}removeClass(element,"loading");addClass(element,"loaded");}else{addClass(element,"failed--empty");}}catch(error){addClass(element,"failed-js");}};htbXhr.onerror=function(e){addClass(element,"failed-xhr");};htbXhr.send(null);}else{addClass(element,"failed--missing-wrapper");}}else{addClass(element,"failed--missing-source");}}function initiateFacebookPixel(){if(typeof window.IDG_CONFIGURATION.facebook_pixel!=="undefined"&&window.IDG_CONFIGURATION.facebook_pixel.enabled){!function(f,b,e,v,n,t,s){if(f.fbq){return;}n=f.fbq=function(){n.callMethod?n.callMethod.apply(n,arguments):n.queue.push(arguments);};if(!f._fbq){f._fbq=n;}n.push=n;n.loaded=!0;n.version="2.0";n.queue=[];t=b.createElement(e);t.async=!0;t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s);}(window,document,"script",window.IDG_CONFIGURATION.facebook_pixel.source);for(var i in window.IDG_CONFIGURATION.facebook_pixel.ids){var id=window.IDG_CONFIGURATION.facebook_pixel.ids[i];if(id!=""){fbq("init",id);fbq("track"https://news.google.com/__i/rss/rd/articles/,"PageView");fbq("track"https://news.google.com/__i/rss/rd/articles/,"ViewContent");}}}}function initiateComscore(){var _comscore=_comscore||[];_comscore.push({c1:"2",c2:"6035308"}),function(){var a=document.createElement("script"),b=document.getElementsByTagName("script")[0];a.async=!0,a.src="https://sb.scorecardresearch.com/beacon.js",b.parentNode.insertBefore(a,b);}();}function initiatePermutive(){try{window.IDG_CONFIGURATION.permutive.debug=(window.location.href.indexOf("permutivedebug=true")>-1);}catch(err){window.IDG_CONFIGURATION.permutive.debug=false;window.IDG_CONFIGURATION.permutive.debug_error=err.message;}if(window.IDG_CONFIGURATION.permutive.debug){console.log("DEBUG Permutive enabled",window.IDG_CONFIGURATION.permutive.enabled);}if(window.IDG_CONFIGURATION.permutive.enabled){!function(n,e,o,r,i){if(!e){e=e||{},window.permutive=e,e.q=[],e.config=i||{},e.config.projectId=o,e.config.apiKey=r,e.config.environment=e.config.environment||"production";for(var t=["addon"https://news.google.com/__i/rss/rd/articles/,"identify"https://news.google.com/__i/rss/rd/articles/,"track"https://news.google.com/__i/rss/rd/articles/,"trigger"https://news.google.com/__i/rss/rd/articles/,"query"https://news.google.com/__i/rss/rd/articles/,"segment"https://news.google.com/__i/rss/rd/articles/,"segments"https://news.google.com/__i/rss/rd/articles/,"ready"https://news.google.com/__i/rss/rd/articles/,"on"https://news.google.com/__i/rss/rd/articles/,"once"https://news.google.com/__i/rss/rd/articles/,"user"https://news.google.com/__i/rss/rd/articles/,"consent"],c=0;c0){return date.replace(" "https://news.google.com/__i/rss/rd/articles/,"T")+":00Z";}return null;}function appendPermutiveAddon(pageDataLayer){var appendAddon=(window.IDG_CONFIGURATION.permutive.enabled&&typeof pageDataLayer!=="undefined"&&pageDataLayer!==null);if(window.IDG_CONFIGURATION.permutive.debug){console.log("DEBUG Permutive appendAddon",appendAddon);}if(appendAddon){var page={type:pageDataLayer.displayType,language:dataLayer[0].propertyCountry,tags:[],keywords:pageDataLayer.metaKeywords,audience:pageDataLayer.audience,description:pageDataLayer.metaDescription,gTax:{primaryIds:[],secondaryIds:[],},ads:{enabled:window.IDG_CONFIGURATION.ads.enabled}};if(typeof pageDataLayer.primaryChannel!=="undefined"&&pageDataLayer.primaryChannel.length>0){page.tags.push(pageDataLayer.primaryChannel);if(typeof window.IDG_CONFIGURATION.permutive.mapping[pageDataLayer.primaryChannel]!=="undefined"){page.gTax.primaryIds.push(window.IDG_CONFIGURATION.permutive.mapping[pageDataLayer.primaryChannel]);}}if(typeof pageDataLayer.secondaryChannels!=="undefined"&&pageDataLayer.secondaryChannels.length>0){for(var i in pageDataLayer.secondaryChannels){var current=pageDataLayer.secondaryChannels[i];page.tags.push(current);if(typeof window.IDG_CONFIGURATION.permutive.mapping[current]!=="undefined"){page.gTax.secondaryIds.push(window.IDG_CONFIGURATION.permutive.mapping[current]);}}}if(pageDataLayer.contentType==="home page"){page.type=pageDataLayer.contentType;}else{if(pageDataLayer.displayType==="article"){var article={type:pageDataLayer.contentType,title:pageDataLayer.headline,description:pageDataLayer.description,source:pageDataLayer.source,id:pageDataLayer.articleId,modifiedAt:formatPermutiveDate(pageDataLayer.dateUpdated),publishedAt:formatPermutiveDate(pageDataLayer.datePublished),authors:pageDataLayer.authors,isInsiderContent:(pageDataLayer.locked==="true")?true:false};page.article=article;}}permutive.addon("web",{page:page});if(window.IDG_CONFIGURATION.permutive.debug){console.log("DEBUG Permutive page",page);}}}function insertHeadFullScript(){if(typeof window.IDG_CONFIGURATION.auth!=="undefined"&&window.IDG_CONFIGURATION.auth.state==="ready"&&window.IDG_CONFIGURATION.async_sources.enabled&&typeof window.IDG_CONFIGURATION.async_sources.full.head!=="undefined"){if(window.IDG_CONFIGURATION.async_sources.full.head.source!=""){appendAsyncJSTag(window.IDG_CONFIGURATION.async_sources.full.head.source);}if(window.dataLayer[0].subscriber&&window.IDG_CONFIGURATION.async_sources.full.head.auth!=""){appendAsyncJSTag(window.IDG_CONFIGURATION.async_sources.full.head.auth);}if(!window.dataLayer[0].subscriber&&window.IDG_CONFIGURATION.async_sources.full.head.unauth!=""){appendAsyncJSTag(window.IDG_CONFIGURATION.async_sources.full.head.unauth);}}}function insertHeadLightScript(){if(typeof window.IDG_CONFIGURATION.auth!=="undefined"&&window.IDG_CONFIGURATION.auth.state==="ready"&&window.IDG_CONFIGURATION.async_sources.enabled&&typeof window.IDG_CONFIGURATION.async_sources.light.head!=="undefined"){if(window.IDG_CONFIGURATION.async_sources.light.head.source!=""){appendAsyncJSTag(window.IDG_CONFIGURATION.async_sources.light.head.source);}if(window.dataLayer[0].subscriber&&window.IDG_CONFIGURATION.async_sources.light.head.auth!=""){appendAsyncJSTag(window.IDG_CONFIGURATION.async_sources.light.head.auth);}if(!window.dataLayer[0].subscriber&&window.IDG_CONFIGURATION.async_sources.light.head.unauth!=""){appendAsyncJSTag(window.IDG_CONFIGURATION.async_sources.light.head.unauth);}}}function insertFooterFullScript(){if(typeof window.IDG_CONFIGURATION.auth!=="undefined"&&window.IDG_CONFIGURATION.auth.state==="ready"&&window.IDG_CONFIGURATION.async_sources.enabled&&typeof window.IDG_CONFIGURATION.async_sources.full.footer!=="undefined"){if(window.IDG_CONFIGURATION.async_sources.full.footer.source!=""){appendAsyncJSTagToBody(window.IDG_CONFIGURATION.async_sources.full.footer.source);}if(window.dataLayer[0].subscriber&&window.IDG_CONFIGURATION.async_sources.full.footer.auth!=""){appendAsyncJSTag(window.IDG_CONFIGURATION.async_sources.full.footer.auth);}if(!window.dataLayer[0].subscriber&&window.IDG_CONFIGURATION.async_sources.full.footer.unauth!=""){appendAsyncJSTag(window.IDG_CONFIGURATION.async_sources.full.footer.unauth);}}else{window.IDG_CONFIGURATION.async_sources.full.footer.waiting=true;}}function insertFooterLightScript(){if(typeof window.IDG_CONFIGURATION.auth!=="undefined"&&window.IDG_CONFIGURATION.auth.state==="ready"&&window.IDG_CONFIGURATION.async_sources.enabled&&typeof window.IDG_CONFIGURATION.async_sources.light.footer!=="undefined"){if(window.IDG_CONFIGURATION.async_sources.light.footer.source!=""){appendAsyncJSTagToBody(window.IDG_CONFIGURATION.async_sources.light.footer.source);}if(window.dataLayer[0].subscriber&&window.IDG_CONFIGURATION.async_sources.light.footer.auth!=""){appendAsyncJSTag(window.IDG_CONFIGURATION.async_sources.light.footer.auth);}if(!window.dataLayer[0].subscriber&&window.IDG_CONFIGURATION.async_sources.light.footer.unauth!=""){appendAsyncJSTag(window.IDG_CONFIGURATION.async_sources.light.footer.unauth);}}else{window.IDG_CONFIGURATION.async_sources.light.footer.waiting=true;}}function insertSponsoredPixel(articleElement){if(typeof articleElement!=="undefined"&&articleElement!=null){if(hasClass(articleElement,"sparticle")&&!hasClass(articleElement,"sptarticle")){updateSponsorTracking(articleElement,articleElement.getAttribute("data-article-sp-dcui"),articleElement.getAttribute("data-article-sp-dcseg"),articleElement.getAttribute("data-article-sp-iframe-name"),articleElement.getAttribute("data-article-sp-iframe-src"));}}}function loadTTDFrames(element){var ttdFrames=element.querySelectorAll(".ttd-frame");var ttdFramesSize=ttdFrames.length;for(var i=0;i0&&typeof configuration_status.vibrant[name]!=="undefined"){var id=configuration_status.vibrant[name];(function(d,s,host,ipid){var e=d.createElement(s);e.type="application/javascript";e.async=!0;e.src="https://"+host+"/intellitxt/front.asp?ipid="+ipid;d.getElementsByTagName(s)[0].parentNode.appendChild(e);})(document,"script"https://news.google.com/__i/rss/rd/articles/,"k.intellitxt.com",id);}}}var pbjs=pbjs||{};pbjs.que=pbjs.que||[];var googletag=googletag||{};googletag.cmd=googletag.cmd||[];if(configuration_status.ab_test.enable){var group=localStorage.getItem(configuration_status.ab_test.name);if(configuration_status.ab_test.activate.indexOf(group)>-1&&typeof configuration_status.ab_test.modal.matching_config[group]!=="undefined"){var currentConfig=configuration_status.ab_test.modal.matching_config[group];window.IDG_CONFIGURATION.consent_disable_modal=currentConfig.consent_disable_modal;}else{window.IDG_CONFIGURATION.consent_disable_modal=configuration_status.ab_test.modal.none_matching_value.consent_disable_modal;}}else{window.IDG_CONFIGURATION.consent_disable_modal=configuration_status.ab_test.modal.default_value.consent_disable_modal;}if(window.IDG_CONFIGURATION.consent_disable_modal){document.addEventListener(window.IDG_CONFIGURATION.event.limbo.name,function(e){window.IDG_CONFIGURATION.event.limbo.dispatched=true;initiateConsentDependenciesHead();});}window.IDG_CONFIGURATION.consent_response_box={enable:true};if(window.location.hostname==="idgsverige.se"){window.IDG_CONFIGURATION.consent_domain="idgsverige.se";}window.IDG_CONFIGURATION.consent_state_ready="init";setTimeout(function(){window.IDG_CONFIGURATION.consent_state_ready=false;if(!window.IDG_CONFIGURATION.consent_state_ready){var waitingHtmlTargets=document.querySelectorAll("."+configuration_status.lazy.html.waiting);for(var i in waitingHtmlTargets){var target=waitingHtmlTargets[i];if(typeof target==="object"){loadHtmlWaiting(target);}}}},configuration_status.consent_timeout);document.addEventListener(window.IDG_CONFIGURATION.event.stored.name,function(e){window.IDG_CONFIGURATION.event.stored.dispatched=true;window.IDG_CONFIGURATION.event.stored.value=localStorage.getItem(window.IDG_CONSENT.storage.name);initiateConsentDependenciesHead();});document.addEventListener(window.IDG_CONFIGURATION.event.action.name,function(e){window.IDG_CONFIGURATION.event.action.dispatched=true;initiateConsentDependencies();});document.addEventListener(window.IDG_CONFIGURATION.event.response.name,function(e){window.IDG_CONFIGURATION.event.response.dispatched=true;});document.addEventListener("lazybeforeunveil",function(e){var lazyTarget=e.target;var classNames=lazyTarget.getAttribute("class");if(typeof classNames!=="undefined"&&classNames!==null){if(hasClass(lazyTarget,"lazy-ad-container")||hasClass(lazyTarget,"ads-container")){if(typeof window.IDG_CONFIGURATION!=="undefined"&&window.IDG_CONFIGURATION.ads.status===configuration_status.done){loadNewPageAds(lazyTarget,lazyTarget.getAttribute("data-page"),lazyTarget.getAttribute("data-selector"));}else{addClass(lazyTarget,configuration_status.lazy.ad.waiting);}}else{if(hasClass(lazyTarget,"lazy-html-container")){if(window.IDG_CONFIGURATION.event.stored.dispatched||(window.IDG_CONFIGURATION.consent_disable_modal&&window.IDG_CONFIGURATION.event.limbo.dispatched)||window.IDG_CONFIGURATION.event.action.dispatched){loadHtmlContent(lazyTarget);}else{loadHtmlWaiting(lazyTarget);}}else{if(hasClass(lazyTarget,"lazy-htb")){loadHTBContent(lazyTarget);}}}}if(configuration_status.custom_lazy_event.active){setTimeout(function(){document.dispatchEvent(new CustomEvent(configuration_status.custom_lazy_event.name,{detail:{target:lazyTarget}}));},100);}});if(typeof window.NSPT!=="undefined"){var nsptId=getUrlParameter("prx_t");if(nsptId.length<=0){var parts=location.href.replace(location.search,"").split("partner/");if(parts.length>1){nsptId=parts[1].replace(/\/|\s/g,"");}}if(nsptId.length<=0){nsptId="nspt";}var nsptSource=window.NSPT.d;nsptSource+="/";nsptSource+=window.NSPT.g;nsptSource+="/";nsptSource+=nsptId;nsptSource+="/pis.gif";var nsptPixel=document.createElement("img");nsptPixel.src=nsptSource;nsptPixel.width=1;nsptPixel.height=1;nsptPixel.style="display:none;";nsptPixel.onload=function(){aiOnLoad();};if(typeof document.body==="undefined"||document.body===null){document.documentElement.appendChild(nsptPixel);}else{nsptPixel,document.body.appendChild(nsptPixel);}}function articleBodyReady(articleIndex,articlePageClass,articleId,isSponsored){var articleBodyReadyIdentifier=articlePageClass+"_"+articleId;if(!(configuration_status.articleBodyReady.indexOf(articleBodyReadyIdentifier)>-1)){if(articleIndex==1){window.firstarticlebodyloaded=true;}configuration_status.articleBodyReady.push(articleBodyReadyIdentifier);document.dispatchEvent(new CustomEvent("articlebodyloaded",{detail:{articleIdNo:articleIndex,articleClass:articlePageClass,articleId:articleId,articleSponsored:isSponsored}}));if(typeof window.IDG_CONFIGURATION.auth&&typeof window.IDG_CONFIGURATION.auth.user!=="undefined"&&typeof window.IDG_CONFIGURATION.auth.user.saved_articles!=="undefined"&&window.IDG_CONFIGURATION.auth.user.saved_articles.length>0){for(var i in window.IDG_CONFIGURATION.auth.user.saved_articles){var articleElement=document.querySelector(".page-"+articleIndex);if(articleElement!==null){if(window.IDG_CONFIGURATION.auth.user.saved_articles[i].article_id===articleElement.getAttribute("data-article-id")){if(!hasClass(articleElement,"article--bookmarked")){addClass(articleElement,"article--bookmarked");}}}}}}}function unauthFeatureLayer(config){var currentLayer=window.dataLayer[0];var parentElement=null;if(typeof config.id!=="undefined"){parentElement=document.querySelector('div[data-article-id="'+config.id+'"]');for(var i in window.dataLayer){if(typeof window.dataLayer[i]!=="function"&&typeof window.dataLayer[i].articleId!=="undefined"&&window.dataLayer[i].articleId===config.id){currentLayer=window.dataLayer[i];break;}}}if(parentElement===null){parentElement=document;}var clickSettings={category:"Paywall Layer",label:"From: "+(typeof currentLayer.headline!=="undefined"&¤tLayer.headline.length>0?currentLayer.headline:currentLayer.property)+" → "+config.layer_class+" → "+currentLayer.property+" → "+currentLayer.contentId,action:"To: "};var layer=parentElement.querySelector("."+config.layer_class);if(layer===null){var userExists=(typeof window.IDG_CONFIGURATION.auth!=="undefined"&&typeof window.IDG_CONFIGURATION.auth.user!=="undefined");var returnurl="";if(typeof config.url!=="undefined"&&config.url!==null){try{returnurl+="?return=";var currenturl=config.url;if(currenturl.indexOf("http://")>-1){currenturl=currenturl.replace("http://"https://news.google.com/__i/rss/rd/articles/,"https://");}returnurl+=encodeURIComponent(currenturl);}catch(err){returnurl="";}}var packageName="";var upgradeUrl=window.IDG_CONFIGURATION.account.page+window.IDG_CONFIGURATION.account.path_o;if(window.dataLayer[0].audience==="consumer"){upgradeUrl+=window.IDG_CONFIGURATION.account.path_o_consumer;packageName=window.IDG_CONFIGURATION.account.package_name_consumer+"-";}else{if(window.dataLayer[0].audience==="enterprise"){upgradeUrl+=window.IDG_CONFIGURATION.account.path_o_enterprise;packageName=window.IDG_CONFIGURATION.account.package_name_enterprise+"-";}}var upgradeTrUrl=upgradeUrl;upgradeUrl+=returnurl;var wrapper=document.createElement("div");wrapper.setAttribute("class"https://news.google.com/__i/rss/rd/articles/,"wwu "+config.layer_class+" visible");var headline=document.createElement("h5");headline.setAttribute("class"https://news.google.com/__i/rss/rd/articles/,"wwu__head");if(window.dataLayer[0].view==="in-app-ios"){headline.innerHTML=(userExists?config.view_headline.existing_user:config.view_headline.new_user).replace(/{packageName}/g,packageName);}else{headline.innerHTML=(userExists?config.headline.existing_user:config.headline.new_user).replace(/{packageName}/g,packageName);}wrapper.appendChild(headline);var info=document.createElement("div");info.setAttribute("class"https://news.google.com/__i/rss/rd/articles/,"wwu__lead");if(window.dataLayer[0].view==="in-app-ios"){info.innerHTML=(userExists?config.view_lead.existing_user:config.view_lead.new_user).replace(/{packageName}/g,packageName);}else{info.innerHTML=(userExists?config.lead.existing_user:config.lead.new_user).replace(/{packageName}/g,packageName);}wrapper.appendChild(info);if(!userExists){var loginLink=document.createElement("a");loginLink.setAttribute("href",window.IDG_CONFIGURATION.account.page+window.IDG_CONFIGURATION.account.path_si+returnurl);loginLink.setAttribute("title"https://news.google.com/__i/rss/rd/articles/,"Logga in");loginLink.innerHTML='';loginLink.addEventListener("click",function(e){if(typeof IDGTrackEvent!=="undefined"){IDGTrackEvent(clickSettings.category,clickSettings.action+window.IDG_CONFIGURATION.account.page+window.IDG_CONFIGURATION.account.path_si,clickSettings.label);}});wrapper.appendChild(loginLink);}if(window.dataLayer[0].view!=="in-app-ios"&&window.dataLayer[0].audience!=="consumer"){var upgradeLink=document.createElement("a");upgradeLink.setAttribute("href",upgradeUrl);upgradeLink.setAttribute("title"https://news.google.com/__i/rss/rd/articles/,"Bli "+packageName+"medlem");upgradeLink.innerHTML='";upgradeLink.addEventListener("click",function(e){if(typeof IDGTrackEvent!=="undefined"){IDGTrackEvent(clickSettings.category,clickSettings.action+upgradeTrUrl,clickSettings.label);}});wrapper.appendChild(upgradeLink);}var closeWrapper=document.createElement("div");closeWrapper.setAttribute("class"https://news.google.com/__i/rss/rd/articles/,"wwu__close");closeWrapper.innerHTML='';closeWrapper.addEventListener("click",function(e){var parent=findParentByClass(e.target,config.layer_class);if(parent!==null){removeClass(parent,"visible");hide(parentElement.querySelector("div.wwu__overlay"));if(typeof IDGTrackEvent!=="undefined"){IDGTrackEvent(clickSettings.category,clickSettings.action+config.layer_class+" toggle collapse",clickSettings.label);}}});wrapper.appendChild(closeWrapper);var overlay=document.createElement("div");overlay.setAttribute("class"https://news.google.com/__i/rss/rd/articles/,"wwu__overlay");parentElement.appendChild(overlay);parentElement.appendChild(wrapper);}else{if(!hasClass(layer,"visible")){show(parentElement.querySelector("div.wwu__overlay"));addClass(layer,"visible");}}if(typeof IDGTrackEvent!=="undefined"){IDGTrackEvent(clickSettings.category,clickSettings.action+config.layer_class+" toggle expand",clickSettings.label);}}function unhandledLockedError(lockedId,lockedPageNumber,lockedUrl,errorMessage,trace,lockedXhr,identifier){var errorBox=prepareLockedErrorInfo(lockedId,lockedUrl,null,errorMessage,trace,lockedXhr,identifier);renderLockedErrorInfo(lockedPageNumber,errorBox);}function renderLockedErrorInfo(pageNumber,errorBox){try{if(typeof pageNumber!=="undefined"&&typeof errorBox!=="undefined"&&errorBox!==null){var articleElement=document.getElementsByClassName("page-"+pageNumber)[0];if(typeof articleElement!=="undefined"){var lockedColumn=articleElement.getElementsByClassName("divColumn1Article");if(typeof lockedColumn!=="undefined"&&lockedColumn.length>0){lockedColumn[0].replaceWith(errorBox);}else{window.lockedArticleBody=errorBox;}}else{window.lockedArticleBody=errorBox;}}}catch(error){window.IDG_CONFIGURATION.auth.error.push({message:"Error renderLockedErrorInfo "+error.message});}}function accountError(id,accountUrl,lockedHtml,errorMessage,trace,xhrResponse,identifier){var error={account_url:accountUrl,message:"Failed to load account response",};if(typeof id!=="undefined"){error.article=id;}if(typeof errorMessage!=="undefined"&&errorMessage!==null){error.message+=" error: ";error.message+=errorMessage;}if(typeof trace!=="undefined"&&trace!==null){var tracktrace=null;try{tracktrace=trace.replace(/\n/g," ").replace(/\s+/g," ");}catch(err){}if(tracktrace!==null){error.message+=" trace: ";error.message+=tracktrace;}}else{if(typeof identifier!=="undefined"&&identifier!==null){error.message+=" identifier: ";error.message+=identifier;}}if(typeof lockedHtml!=="undefined"&&lockedHtml!==null){try{var errorMessage=lockedHtml.getAttribute("data-error-message");if(typeof errorMessage!=="undefined"&&errorMessage!==null){error.message+=" html error: ";error.message+=errorMessage;}else{var text=lockedResponse.innerText;if(typeof text!=="undefined"&&text!==null){error.message+=" html error: ";error.message+=text;}}}catch(e){}}if(typeof xhrResponse!=="undefined"&&xhrResponse!==null){try{if(typeof xhrResponse.status!=="undefined"){error.code=xhrResponse.status;}if(typeof xhrResponse.statusText!=="undefined"){error.status=xhrResponse.statusText;}if(typeof xhrResponse.responseText!=="undefined"&&xhrResponse.responseText.startsWith("{")){var response=JSON.parse(xhrResponse.responseText);if(typeof response.message!=="undefined"&&error.message.indexOf(response.message)<0){error.message+=" response error: ";error.message+=response.message;}if(typeof response.status_text!=="undefined"){error.message+=" response status_text: ";error.message+=response.status_text;}if(typeof response.status_code!=="undefined"){error.message+=" response status_code: ";error.message+=response.status_code;}}}catch(e){}}try{error.location=location.href;if(error.location.indexOf("?")>-1){error.location=error.location.substr(0,error.location.indexOf("?"));}}catch(e){}window.IDG_CONFIGURATION.auth.error.push(error);try{if(typeof error.article!=="undefined"&&error.article!==null&&error.article.length>0){var errorUrl=window.IDG_CONFIGURATION.account.source;errorUrl+="/error/log";errorUrl+="?";if(typeof error.status!=="undefined"){errorUrl+="status=";errorUrl+=encodeURIComponent(error.status);}if(typeof error.code!=="undefined"){errorUrl+="&code=";errorUrl+=encodeURIComponent(error.code);}if(typeof error.message!=="undefined"){errorUrl+="&message=";errorUrl+=encodeURIComponent(error.message);}if(typeof error.location!=="undefined"){errorUrl+="&location=";errorUrl+=encodeURIComponent(error.location);}var errorXhr=new XMLHttpRequest();errorXhr.open("GET",errorUrl);errorXhr.withCredentials=true;errorXhr.crossDomain=true;errorXhr.send(null);}}catch(err){}}function prepareLockedErrorInfo(lockedId,lockedUrl,lockedResponse,lockedErrorMessage,traceError,xhrlockedResponse,identifier){try{accountError(lockedId,lockedUrl,lockedResponse,lockedErrorMessage,traceError,xhrlockedResponse,identifier);var columnInformation=document.createElement("div");columnInformation.setAttribute("class"https://news.google.com/__i/rss/rd/articles/,"divColumn1Article");var columnBodyText=document.createElement("div");columnBodyText.setAttribute("class"https://news.google.com/__i/rss/rd/articles/,"articleBodyText emptyBodyText");var errorInformation=document.createElement("div");errorInformation.setAttribute("class"https://news.google.com/__i/rss/rd/articles/,"article-premium__teaser article-premium__teaser--box-error article-premium__teaser--box-alone");var errorHeader=document.createElement("div");errorHeader.setAttribute("class"https://news.google.com/__i/rss/rd/articles/,"wwu");var errorHead=document.createElement("h5");errorHead.setAttribute("class"https://news.google.com/__i/rss/rd/articles/,"wwu__head");errorHead.innerHTML="Tillfälligt fel";var errorText=document.createElement("div");errorText.setAttribute("class"https://news.google.com/__i/rss/rd/articles/,"wwu__lead");errorText.innerHTML="Artikeln kunde tyvärr inte hämtas. Vänligen försök igen om en stund.";errorHeader.appendChild(errorHead);errorHeader.appendChild(errorText);errorInformation.appendChild(errorHeader);columnBodyText.appendChild(errorInformation);columnInformation.appendChild(columnBodyText);return columnInformation;}catch(err){window.IDG_CONFIGURATION.auth.error.push({message:"Error prepareLockedErrorInfo "+err.message});return null;}}function prepareLockedInfo(lockedId,lockedPageNumber,lockedPageSelector,lockedResponse){var response=lockedResponse;var currentLayer=window.dataLayer[0];for(var i in window.dataLayer){if(typeof window.dataLayer[i]!=="function"&&typeof window.dataLayer[i].articleId!=="undefined"&&window.dataLayer[i].articleId===lockedId){currentLayer=window.dataLayer[i];break;}}var clickSettings={category:"Article Paywall",action:"To: ",label:"From: "+(currentLayer.headline.length>0?currentLayer.headline:currentLayer.property)+" → "+currentLayer.property+" → "+currentLayer.contentId};var returnurl=null;var currentDomain=null;var property=dataLayer[0].property;try{if(typeof currentLayer.property!=="undefined"&¤tLayer.property!==null&¤tLayer.property.length>0){property=currentLayer.property;}currentDomain="https://";if(property==="idgse"){currentDomain+="www";}else{currentDomain+=property;}currentDomain+=".idg.se";}catch(err){}var article=null;try{article=document.querySelector(".page-"+lockedPageNumber);if(article!==null&¤tDomain!==null){var part=article.getAttribute("data-article-ga-url");if(typeof part!=="undefined"&&part!==null){returnurl=currentDomain+part.trim();}}}catch(err){}if(returnurl===null&¤tDomain!==null){returnurl=currentDomain+"/"+currentLayer.layoutId+"/"+currentLayer.articleId;}if(returnurl===null){try{if(lockedPageNumber===1){var canonical=document.querySelector("link[rel="canonical"]");if(typeof canonical!=="undefined"&&canonical!==null){returnurl=canonical.getAttribute("href");if(!(typeof returnurl!=="undefined"&&returnurl!==null&&returnurl.length>0&&returnurl.indexOf(property)>-1)){returnurl=null;}}}if(article!==null&&returnurl===null){returnurl=article.getAttribute("data-article-canonical");}if(typeof returnurl!=="undefined"&&returnurl!==null){returnurl=returnurl.trim();}else{returnurl=null;}}catch(err){}}if(typeof returnurl!=="undefined"&&returnurl!==null){try{if(returnurl.indexOf("http://")>-1){returnurl=returnurl.replace("http://"https://news.google.com/__i/rss/rd/articles/,"https://");}returnurl=encodeURIComponent(returnurl);}catch(err){returnurl="";}}else{returnurl="";}var userExists=(typeof window.IDG_CONFIGURATION.auth.user!=="undefined");if(currentLayer.audience==="enterprise"){try{var visitingHour="";var trafficSource="";var paywallViews="";var hourFrom=19;var hourTo=4;var hourNow=new Date().getHours();if(hourNow>=hourFrom&&hourTo<=hourNow){visitingHour="visitingOoo";}else{var documentRef="";if(typeof document.referrer!=="undefined"&&document.referrer!==null){documentRef=document.referrer;}var refTwitter="https://t.co/";var refFb="facebook.com";var refGoogle="google.com";var refConditions=[refTwitter,refFb,refGoogle];if(refConditions.some(function(v){return documentRef.indexOf(v)>=0;})){trafficSource="refMatch";}else{if(localStorage.getItem("permutive-data")!==null){var f=JSON.parse(localStorage.getItem("permutive-data")).query_states;var allSegments=f;var pwSegment="26579";if(allSegments.hasOwnProperty(pwSegment)){if(allSegments[pwSegment]["result"]["result"]){paywallViews="paywallHit";}}}}}if((trafficSource=="refMatch")||(paywallViews=="paywallHit")||(visitingHour=="visitingOoo")){var rootElement=document.documentElement;rootElement.classList.add("wwu--has-v1");}}catch(err){}}if(window.dataLayer[0].view==="in-app-ios"){try{var headline=response.querySelector(".wwu__head");if(headline!==null){if(userExists){headline.innerHTML="Du är inloggad som "+window.IDG_CONFIGURATION.account.package_name+"-medlem";}else{headline.innerHTML="Logga in";}}var lead=response.querySelector(".wwu__lead");if(lead!==null){var iosPackageName=(currentLayer.audience==="consumer"?window.IDG_CONFIGURATION.account.package_name_consumer:window.IDG_CONFIGURATION.account.package_name_enterprise);if(userExists){lead.innerHTML="Som "+iosPackageName+'-medlem läser du artiklar obegränsat. Tyvärr kan du inte ändra ditt medlemskap i appen.
Läs om hur du ändrar ditt medlemskap på support.idg.se';}else{lead.innerHTML="Som "+iosPackageName+"-medlem läser du artiklar obegränsat.";}}var primaryButton=response.querySelector("button[data-auth]");if(primaryButton!==null){primaryButton.parentNode.removeChild(primaryButton);}if(!userExists){var secondaryButton=response.querySelector(".wwu__btn--secondary");if(secondaryButton!==null){removeClass(secondaryButton,"wwu__btn--secondary");addClass(secondaryButton,"wwu__btn--primary");}}}catch(err){}}var responseButtons=response.querySelectorAll(".wwu__btn");for(var i in responseButtons){try{var current=responseButtons[i];if(typeof current==="object"){var clickElement=current;var listener=current.getAttribute("data-listener");if(!(listener!==null&&typeof listener!=="undefined")){var parentLink=current.parentElement;if(parentLink!==null&&parentLink.tagName==="A"){clickElement=parentLink;try{var href=clickElement.getAttribute("href");if(href!==null&&href.indexOf("return=http")>-1&&href.indexOf("return=https")<0){clickElement.setAttribute("href",href.replace("return=http"https://news.google.com/__i/rss/rd/articles/,"return=https"));}}catch(error){}}clickElement.addEventListener("click",function(e){var button=e.target;if(e.target.tagName==="A"){button=e.target.querySelector("button");}if(typeof IDGTrackEvent!=="undefined"){IDGTrackEvent(clickSettings.category,clickSettings.action+button.innerText,clickSettings.label);}});}}}catch(err){}}var responseLinks=response.querySelectorAll("a[data-member-link]");for(var i in responseLinks){try{var current=responseLinks[i];if(typeof current==="object"){var linkElement=current;var href=window.IDG_CONFIGURATION.account.page+linkElement.getAttribute("data-member-link");if(href!==null&&!(href.indexOf("return=")>-1)&&returnurl!==null&&returnurl.length>0){href+=(href.indexOf("?")>=0?"&":"?");href+="return=";href+=returnurl;}linkElement.setAttribute("href",href);linkElement.addEventListener("click",function(e){if(typeof IDGTrackEvent!=="undefined"){IDGTrackEvent(clickSettings.category,clickSettings.action+e.target.innerText,clickSettings.label);}});}}catch(err){}}return response;}function loadLockedArticleHtml(lockedId,lockedPageNumber,lockedPageSelector){var pageNum=1;try{var regexp=/(\/sida\/)([0-9]{1,3})/g;var match=regexp.exec(window.location.href);if(match!=null){var num=parseInt(match[2],10);if(num>=1){pageNum=num;}}}catch(err){}var articleUrl=window.IDG_CONFIGURATION.account.source;articleUrl+=window.IDG_CONFIGURATION.account.path_ar;articleUrl+="/";articleUrl+=lockedId;articleUrl+="/";articleUrl+=pageNum;var lockedXhr=new XMLHttpRequest();lockedXhr.open("GET",articleUrl);lockedXhr.withCredentials=true;lockedXhr.crossDomain=true;lockedXhr.onload=function(){var hasError=false;try{var data=lockedXhr.responseText;var code=data.replace(/document.write/gi,"console.error");var wrapper=document.createElement("div");wrapper.innerHTML=code;var response=wrapper.firstElementChild.cloneNode(true);if(typeof response!=="undefined"&&response!==null){var access=hasClass(response,window.IDG_CONFIGURATION.premium.access);hasError=hasClass(response,"error");var dataUser=response.getAttribute("data-user");if(typeof dataUser!=="undefined"&&dataUser!==null&&dataUser.length>0){var user=JSON.parse(dataUser.replace(/\'/g,'"'));window.IDG_CONFIGURATION.auth.user=user;if(typeof user.packages!=="undefined"){window.IDG_CONFIGURATION.auth.packages=user.packages;}}if(!access){response=prepareLockedInfo(lockedId,lockedPageNumber,lockedPageSelector,response);}if(hasError){response=prepareLockedErrorInfo(lockedId,articleUrl,response,null,null,lockedXhr,"lockedXhr onload hasError");}if(typeof response!=="undefined"&&response!==null){var articleElement=document.getElementsByClassName("page-"+lockedPageNumber)[0];if(typeof articleElement!=="undefined"){var lockedColumn=articleElement.getElementsByClassName("divColumn1Article");if(typeof lockedColumn!=="undefined"&&lockedColumn.length>0){lockedColumn[0].replaceWith(response);if(response.getAttribute("data-unlocked-first-page")==="true"){addClass(articleElement,"article-premium--intro");}if(access){addClass(articleElement,window.IDG_CONFIGURATION.premium.unlocked);removeClass(articleElement,window.IDG_CONFIGURATION.premium.locked);addImageTracker("https://ax.idg.se/ko01/"+lockedId+"-unlock/pis.gif",articleElement);}else{addClass(articleElement,window.IDG_CONFIGURATION.premium.locked);addImageTracker("https://ax.idg.se/ko01/"+lockedId+"-wwu/pis.gif",articleElement);}removeClass(articleElement,window.IDG_CONFIGURATION.premium.loading);articleBodyReady(lockedPageNumber,lockedPageSelector,lockedId,hasClass(articleElement,"sparticle"));}else{window.lockedArticleBody=response;if(access){addImageTracker("https://ax.idg.se/ko01/"+lockedId+"-unlock/pis.gif",document.body);}else{addImageTracker("https://ax.idg.se/ko01/"+lockedId+"-wwu/pis.gif",document.body);}}}else{window.lockedArticleBody=response;if(access){addImageTracker("https://ax.idg.se/ko01/"+lockedId+"-unlock/pis.gif",document.body);}else{addImageTracker("https://ax.idg.se/ko01/"+lockedId+"-wwu/pis.gif",document.body);}}}else{unhandledLockedError(lockedId,lockedPageNumber,articleUrl,"Missing required response to render",null,lockedXhr,"lockedXhr onload handling response");}}else{unhandledLockedError(lockedId,lockedPageNumber,articleUrl,"Missing required response to render",null,lockedXhr,"lockedXhr onload response");}}catch(error){if(hasError){unhandledLockedError(lockedId,lockedPageNumber,articleUrl,error.message,(error.stack||error.stacktrace),lockedXhr,"lockedXhr onload catch hasError");}else{accountError(lockedId,articleUrl,null,error.message,(error.stack||error.stacktrace),lockedXhr,"lockedXhr onload catch");}}finally{authReady(lockedPageNumber);}};lockedXhr.onerror=function(e){unhandledLockedError(lockedId,lockedPageNumber,articleUrl,e.message,(e.stack||e.stacktrace),lockedXhr,"lockedXhr onerror");authReady(lockedPageNumber);};lockedXhr.send(null);}if(window.dataLayer[0].locked==="true"&&window.dataLayer[0].unlockedByTime!=="true"&&(window.dataLayer[0].pageNumber!=="1"||(window.dataLayer[0].pageNumber==="1"&&window.dataLayer[0].lockedFirstPage==="true"))){loadLockedArticleHtml(window.dataLayer[0].articleId,1,"page-1");}else{if(window.IDG_CONFIGURATION.account.enabled){var authXhr=new XMLHttpRequest();authXhr.open("GET",window.IDG_CONFIGURATION.account.source+window.IDG_CONFIGURATION.account.path_au);authXhr.withCredentials=true;authXhr.crossDomain=true;authXhr.onload=function(){try{var response=JSON.parse(authXhr.responseText);if(typeof response.error!=="undefined"){accountError(null,window.IDG_CONFIGURATION.account.source+window.IDG_CONFIGURATION.account.path_au,null,response.message,null,authXhr,"authXhr onload response.error");}else{if(response.success&&typeof response.user!=="undefined"){window.IDG_CONFIGURATION.auth.user=response.user;if(typeof response.user.packages!=="undefined"){window.IDG_CONFIGURATION.auth.packages=response.user.packages;}}}}catch(error){accountError(null,window.IDG_CONFIGURATION.account.source+window.IDG_CONFIGURATION.account.path_au,null,error.message,(error.stack||error.stacktrace),authXhr,"authXhr onload catch");}finally{authReady(1);}};authXhr.onerror=function(e){accountError(null,window.IDG_CONFIGURATION.account.source+window.IDG_CONFIGURATION.account.path_au,null,e.message,(e.stack||e.stacktrace),authXhr,"authXhr onerror");authReady(1);};authXhr.send(null);}else{window.IDG_CONFIGURATION.auth.state="ready";window.IDG_CONFIGURATION.waiting_auth=false;gaPageView(1);ioPageView(dataLayer[0]);}}if(window.location.href.indexOf("tooltip=welcome")>-1){document.documentElement.classList.add("idg-konto-tip--active");setTimeout(function(){removeClass(document.documentElement,"idg-konto-tip--active");},4000);}