Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>In my limited experience, changeVersion does work on Chrome. I've also read complaints <a href="http://html5doctor.com/introducing-web-sql-databases/#comment-28482" rel="nofollow">here</a> about it not working properly on Safari, but it does. </p> <p>However, there are two catches:</p> <p>Catch 1:</p> <p>Often, changeVersion <em>appears</em> to fail (it gives an error and db.version will still return the old value), but the transaction callback will fire and when you re-open the web page and its database, the version number will be correct.</p> <p>Catch 2:</p> <p>It seems you must supply precisely five arguments, including three callbacks. If you don't supply these five arguments, for example you only do the first three, then the current version will remain unchanged. So if you were to follow the instruction in <a href="http://blog.maxaller.name/2010/03/html5-web-sql-database-intro-to-versioning-and-migrations/" rel="nofollow">this tutorial</a> that everyone's referring to, you would be disappointed.</p> <p>This is the case for Chrome and Safari on Windows.</p> <p>Arguments are: 1: expected version 2: new version 3: transaction callback (you can execute SQL here as part of the version change) 4: failure callback (if version change or transaction callback failed) 5: succes callback (if version change and transaction callback succeeded)</p> <p>I haven’t tested this on iOS devices but it matches the Safari specifications provided here: <a href="https://developer.apple.com/library/safari/#documentation/iphone/conceptual/safarijsdatabaseguide/usingthejavascriptdatabase/usingthejavascriptdatabase.html" rel="nofollow">https://developer.apple.com/library/safari/#documentation/iphone/conceptual/safarijsdatabaseguide/usingthejavascriptdatabase/usingthejavascriptdatabase.html</a></p> <p>In <strong>Opera</strong>, changeVersion waits with setting db.version to its new value until after you've executed an actual sql transaction using executeSql. So I use a SELECT statement that has no further consequence. This does not actually have to be inside the transaction callback: I discovered it when I tried a separate executeSql statement in the browser console after trying a whole bunch of changeVersion commands.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload