WebViewGold Documentation · Android
🇺🇸 English
Get WebViewGold

Haptic Feedback API

Trigger native vibration haptic feedback from your web app for a native app feeling on Android.

WebViewGold allows for the implementation of native Android haptic control within your web app. Using our API, you are able to perform the following actions:

Light Impact
lighthaptic://
Used for a collision between small, light UI elements
Heavy Impact
heavyhaptic://
Used for a collision between large, heavy UI elements
Success Notification
successhaptic://
Indicates a task or action has been successfully completed
Warning Notification
warninghaptic://
Indicates a task or action has produced a warning of some kind
Error Notificiation
errorhaptic://
Indicates that an error has occurred

An example of how this API can be utilised can be seen below, with an anchor tag and custom javascript function which interact with our haptic API.

<a onclick="lightHaptic('index.html')">Navigation Link with Haptics</a>

<script>
function lightHaptic(url) {
  if (isWebViewBrowser) {
    window.location.href = url;
    loadInnerHref("lighthaptic://");
  } else {
    window.location.href = url;
  }
}

function loadInnerHref(url) {
  iFrame = document.createElement("iframe");
  iFrame.setAttribute("src", url); 
  document.body.appendChild(iFrame);
  iFrame.parentNode.removeChild(iFrame);
  iFrame = null;
}
</script>

Click here to view a demonstration web page for this feature. Inspect the page to view the example code.

Too busy? We set up your app for you.

Our team configures, builds & submits your WebViewGold app — done-for-you, fast turnaround, Made in Germany.

Get your app set up →

Build in your browser

No Mac, no IDE: the WebViewGold Cloud Builder configures, builds & uploads your app online.

Discover Cloud Builder →