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 7924673
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T17:52:09+00:00 2026-06-03T17:52:09+00:00

im developing uiwebview in my app. this UIWebView displays HTML5 pages and has javascript

  • 0

im developing uiwebview in my app.
this UIWebView displays HTML5 pages and has javascript which access local db and displays lists of menu.

Problem is that i need to copy this database from app’s document directory and paste it to safari/databases folder..so that my javascript file can access this db and display list of files.

however no success in copying file from document folder to safari/Databases folder
here is my code:

    NSString *databasepath=[NSString stringWithFormat:@"~/Library/%@/%@",@"safari",@"databases"];

    NSFileManager *fileManager = [NSFileManager defaultManager];
    NSError *error;

NSString *resourcePath = [[NSBundle mainBundle] pathForResource:@"sfa.db" ofType:nil];
[fileManager copyItemAtPath:resourcePath toPath:databasepath error:&error];

Any help will b appreciated.
Thanks in advance.


Thanks for all of ur replies. although it doesnt solve my problem..

1) I want javascript to connect with existing sqlite3 database located in my app’s document directory.
2) but OpenDatabase() method always points to safari/databases directory

3) either i get a way to b able to point document directory in OpenDatabase() method
OR
some other way to keep a copy of my sqlite3 database from my app’s document directory to Safari/Databases

OR
any other way to solve this problem.

  • 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-03T17:52:19+00:00Added an answer on June 3, 2026 at 5:52 pm

    I solved my problem using function stringByEvaluatingJavaScriptFromString
    here is my code:

    in my model:

    -(void)webViewDidFinishLoad:(UIWebView *)webView {
    //getMenuItems is fetches items from database
        [self getMenuItems];
    //array items converted to string seperated by ","
         NSString *string = [[arr valueForKey:@"description"] componentsJoinedByString:@","];
    
    //load is javascript function
        NSString *str=[NSString stringWithFormat:@"load('%@');",string];
    
    [web stringByEvaluatingJavaScriptFromString:str]; 
    }
    

    in my html

       function load(example_array){
            var example_array=example_array.split(",");
        var select = document.getElementById("ddlMenu");
    
            for(i=0;i<=example_array.length-1;i++) {
            select.options[select.options.length] = new Option(example_array[i], i);
        }
    
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Am developing an app which has a calculator function: for example, i have 4
Am developing an app which load a HTML page into uiwebview - that html
I am developing an iPhone app which retrieves information via NSUrlRequest and displays through
I'm developing an iOS app with a UIWebView instance. If the user touches an
In an iOS app I'm developing, I show an UIWebView to allow the user
I'm developing an app that use a lot of images, I'm using the UIWebView
I'm developing an iphone app that makes use of of a UIWebView to display
I'm investigating the feasibility of developing a native (hybrid) app based on HTML/Javascript (using
Developing a brand new schema/app which uses hibernate to create tables from pojo's. My
I am developing a web app that is being displayed in a UIWebView .

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.