Worried about target=”_blank” links in your WebView apps on iOS & Android? Check this out! 🔑

Concentrated programmer man work on laptop in evening in empty office o fixing bug in application

Introduction

A “target” attribute in the tag specifies where the linked page will be opened. The attribute value can be either “_self”, “_parent”, “top”, “bottom”, or a page name (e.g., “_blank”). Target=”blank” links are hyperlinks that open a new browser window or tab with the target website.

Many apps nowadays use WebViews to display web pages through an application. These types of apps are also called hybrid apps and can be installed on the device through the App Store (iOS) and Play Store (Android). WebViews are the best way to implement your app with a web-like feel. It is the best alternative for native apps. WebViews can load any content from a URL and be used as an extension of your native app.



The Problem

We should use WebViews to their full potential and make them more than just an extension of the native app. We should also think of them as separate entities capable of performing all their tasks to give users a better experience on their devices. Besides their many features and advantages, WebView apps on iOS and WebView-based apps on Android come with a huge disadvantage: Their non-ability to handle all of these link types correctly:



  • target=”_blank”
  • target=”_self”
  • window.location.href
  • window.location
  • top.location.href
  • top.location
  • window.open


The Solution

WebViewGold has supported these mentioned WebView-links out of the box for a few months. Whether you want to use it to upgrade from your existing app or build a new WebView-based app for iOS & Android from scratch, this app template can save you tons of time and energy