Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8726419
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:14:26+00:00 2026-06-13T08:14:26+00:00

Hi, quick question. What is the best way to call native from webview. An

  • 0

Hi, quick question.

What is the best way to call native from webview. An iframe or a window.location ?

eg:

gapBridge = document.createElement("iframe");
gapBridge.setAttribute("style", "display:none;");
gapBridge.setAttribute("height","0px");
gapBridge.setAttribute("width","0px");
gapBridge.setAttribute("frameborder","0");
document.documentElement.appendChild(gapBridge);
gapBridge.src = custom + "://" + custom;

or :

window.location = custom + "://" + custom;

Ps : btw changing the src in embeded webview does not seem to work. As revealed by other article on stack here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T08:14:27+00:00Added an answer on June 13, 2026 at 8:14 am

    An iframe seems to be better on my case. The problem I see with window.location is that if you have multiple calls in sequence the browser will ignore some. While using an iframe you can actually create multiple iframes one for each call. I also delete the iframe after a delay so I don’t find myself with a huge DOM of empty iframes.

    Here’s the function I use:

    function _callNative(url){
        var _frame = document.createElement('iframe');
        _frame.width=0; _frame.height=0;_frame.frameBorder=0;
        document.body.appendChild(_frame);
        if (url.indexOf('?') >= 0){
            url = url + "&cb=";
        }else{
            url = url + "?cb=";
        }
        _frame.src = url + Math.round(Math.random()*1e16);
        // Remove the iframe
        setTimeout(function(){document.body.removeChild(_frame);}, 2000);
    }
    

    eg:

    _callNative('native://doSomethingNative()');
    _callNative('native://doSomethingElse')
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Have a quick question about what would be the best way to implement iterators
I've got a quick question regarding the use of repositories. But the best way
Hello $mostamazingforumforfastanswersever. I have a quick silly question; what is the best way to
quick question, what's the best way to convert language a abbreviation to full name?
Quick question: What's the best way to go about removing <br> and <br />
Quick question - I'm trying to decide the best way to store some site
quick question: What is the best way for implementing this line of python code
I have a quick question on the best way to show a particular message
A quick question on best practice for handling images in a PHP/MySQL CMS. Each
Just a quick question about best practice in MVC development. Let's say that I've

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.