Sponsors

 
Showing posts with label javascript. Show all posts
Showing posts with label javascript. Show all posts

Tuesday, August 7, 2007

Desired Programming Features

There are various forms of "wish lists" out on the Internet regarding features people want added to the iPhone. This wish list is narrowed down to things I as a programmer would like to see added to the iPhone Safari browser.

The first list of items I want to cover actually could be applied to any web browser on any platform. Yup! I think that the following would be of immense use running under windows or Linux, using IE, FireFox, Opera or Safari! Ok, so this is more than what I said in the first paragraph!

The second list of items is a wish list of iPhone specific things I would like to see added to the iPhone Safari browser's functionality. These items have to do with interacting with the iPhone's user interface.

List 1: Enhanced Programming Functionality for All Browsers (Especially iPhone Safari):

  • A "webapp" meta tag. If the web browser sees this, it will know to save the file in a special area for the domain it came from.
  • When the browser sees that the page is flagged "webapp", it will call the server via the domain that allegedly sent the page to the browser. To will expect a response from the server. The purpose of this functionality will be to prevent a web app that has it's domain spoofed from being able to run. This challenge response would only be done once during the web app's installation.
  • Users would always be prompted before installing a new web app.
  • The web browser will have its own web app page that can be accessed either from the menu or the main toolbar.
  • The user can bring up this page and click on a link/button to start the web app.
  • The web app will run locally (unless a URL on an image or link points to an external domain).
  • Users would be able to delete web apps from their web app page.
  • Users could set up the maximum storage space allowed for all web apps on the client computer.
  • Users could set up the maximum storage space for a domain or sub-domain that the web app is coming from.
  • Users could set up domains which they wish to automatically block any web apps from installing on their PC.
  • The storage for web apps would hold the following items: HTML files, Javascript files, image files, mp3 files, own cookie area, it's own private database instance.
  • All data for a web app would be stored encrypted.
  • Each web app would have it's own private database instance. This instance could have one or more schemas. One could use pretty generic SQL to work with a schema.
  • For a web app running on an iPhone (at least), another meta tag could specify an image file to be used as a button (for the web apps page).
  • All scripting would be done in Javascript.
  • All the new functionality would be exposed via the new webapp object.
  • webapp.databases would expose any database schemas as well as methods to work with them.
  • Cookies would work like normal from a programmer's perspective but would be saved in the web app's own storage area.
  • webapp.getInstallDate() would return a date object with the date/time the web app was installed.
  • webapp.getDomain() would return the domain/sub-domain that the web app came from.
  • webapp.databases.createSchema(schemaName) could be used to create and return a new schema object.
  • webapp.databases.getSchema(schemaName) would return an existing schema object.
  • webapp.databases.deleteSchema(schemaName) would delete a schema name. If successful, it would return a value of True.
  • webapp.databases.getSchemaList() This method would return a javascript text array of all the schemas that the databases object contains.
  • schemaObject.addTable(tableName) Would create a new table. Could Use DDL too.
  • schemaObject.delTable(tableName) Would delete a table. Could use DDL too.
  • schemaObject.executeSQL(sql) Would execute SQL. If running a SELECT statement, it would return a recordsetObject.
  • schemaObject.beginTransaction()
  • schemaObject.commitTransaction()
  • schemaObject.rollbackTransaction()
  • recordsetObject.getRecordCount()
  • recordsetObject.moveFirst()
  • recordsetObject.moveLast()
  • recordsetObject.moveNext()
  • recordsetObject.movePrevious()
  • recordsetObject.getFieldValue(fieldName)
List 2: Enhanced Programming Functionality Desired (iPhone Specific)

  • An "ontouch" event. The event object would return an array. Each array element would contain an object holding the coordinate of a pixel that was being "touched" at the time, as well as a timestamp when the event occurred. Using this info, one could even write a finger painting type app which captured all the subtleties of the user's finger gestures.

    Example:
    var touched = event.touched;
    alert("pixels touched="+touched.length;
    var dot = touched[0];
    alert("coords:"+dot.x+","+dot.y);
    alert("timestamp: "+dot.date);

  • An "onrelease" event. Would work the same way as the ontouch event but the array of objects it would return would be of all the pixels that were being pressed but now are not being pressed! Sort of like mouseup but more robust.
  • An "onresize" event for the body tag that works properly!
  • window.makeAsyncSound(sSoundFileName) This would return a asyncSound object.
  • asyncSound.onplay used to trigger code to run when sound starts to play.
  • asyncSound.onplaydone used to trigger code to run when sound is done playing.
  • asyncSound.play() plays sound.
  • asyncSound.getStatus() returns the status: 0=not playing 1=playing 2=error
  • asyncSound.stopPlay() stops playing sound (if it is currently playing)

I think this is a good start. What do you think? What are some possible security issues in the web app architecture that I've set forth? I'm planning on adding and tweeking this page as you give feedback and as I get more ideas. Perhaps it will inspire some Safari browser developers?

Some iPhone Development Tools

Here's a list of some development tools for the iPhone that I've stumbled upon. I found this batch on the Juixe TechKnow page talking about the iPhone DevCamp. At this point I have yet to really use all the functionality offered by them. I've just visited their pages and read up on them abit. I've not included everything from this page because I've got links to those other things elsewhere on my blog. I've tried to flesh out some more details for you though.
  • iPhoney - This is a free, open-source web simulator one can use for working on an iPhone app on your PC. One little note: I keep debugging turned on in IE and this page gets some javascript errors. Tisk, tisk!
  • Ajaxian page covering iPhone development tips. Right now there are some tips on using Javascript to check the orientation of your iPhone and adjust for it, getting rid of the tool bar, using the "viewport" option of the meta tag, and a few other bits. As with many resources out there right now it is a bit sparse.
  • David Cann's iPhone Simulator. It's fun to flick the list up and down in this simulated iPhone. I'm not sure (its not clear to me) if this just allows you to play with a virtual iPhone on your PC or if somehow one can use it to debug their own iPhone apps.
  • TestiPhone.com - iPhone Simulator. This one really looks attractive to me. Supposedly it works best if you use it with the Safari 3 browser. It also works with IE7 and FireFox 2. You can type in your URL in the simulated URL textbox and press ENTER. And it works. I tried this one out abit. Note the Google page doesn't automatically come up. Hitting the "Refresh" button does not work right. I had some frame issues. But this shows real potential. If they get this working completely, one could try stuff out without needing to install alll sorts of stuff on one's PC. Currently it does not support zooming, though they are working on it.
  • Firebug for the iPhone. Joe Hewitt has created this tool for testing Javascript on your iPhone. It appears to allow you to enter javascript into a web site on your regular PC, the site in turn "sends" the javascript to your iPhone, the iPhone then runs the javascript and returns the results. The results are displayed on your nice large computer monitor of your PC instead of the iPhones relatively small screen. The server stuff is written in Python. I don't know Python, but Joe's thoughts have given me some ideas of my own.