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

  • SEARCH
  • Home
  • 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 8919567
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T06:03:49+00:00 2026-06-15T06:03:49+00:00

I have an IOS application which has a web browser in it. When this

  • 0

I have an IOS application which has a web browser in it.

When this web browser is displayed, it navigates to a page on Internet, say http://myexample.com/myiosapp.

Is it possible to place a javascript code on this web site, which, when downloaded to phone, communicates with the native application? Can it call an Objective-C method, or write something to storage space of this application?

Ex.
Code hosted on myexample.com/myios app:

function saveSomeString() {
    xcode.Save("somestring");
}

should call an Objective-C function named Save, which saves incoming string parameter to local storage.

  • 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-15T06:03:51+00:00Added an answer on June 15, 2026 at 6:03 am

    Yes, you can, but it is a bit hacky.

    On the Objective-C side:

    Basically, in the UIWebView, you will use method shouldStartLoadWithRequest (from the UIWebViewDelegate) which is called before a URL request starts:

    - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
    

    On Javascript side:

    Your javascript code will navigate to a ‘fake’ URL that you will filter on the method above. Something like:

    window.location = "js2objc://save:param";
    

    Back on the Objective-C side:

    Inside the method I mentioned earlier, you look for the keyword js2objc (or whichever you choose) and then extract the info and take any appropriate action:

    if([[url scheme] isEqualToString:@"js2objc"]){
        // extract the parameters and save them, o do whatever action you need
        return NO;  // so the UIWebView doesn't actually follow the url
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Currently on iOS 5 I have an iPhone application that contains web views which
I have an ASP.NET Web Application that has a dropdownlist which pulls up student
I have an IOS application which uses environment variables and am able to set
I have made an application which uses latest ios facebook sdk to connect. I
I'm working on an application for iOS which will have the user fill out
In iOS 5, I have created a splitViewController based application in which I have
I have an iOS application. Application has 2 different views: Main and Settings. In
I have created a simple application which has a red background and a button
We have an iOS app which has been approved for release with its version
This is really really a weird case .. I have an application which is

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.