javascript - pass imageURI to another html page -
i use phonegap create mobile app can select image album, , want pass image , show in html page. have idea how that? here code
selectimage.html
<!doctype html> <html> <head lang="en"> <meta charset="utf-8"> <title></title> <script type="text/javascript" src="cordova.js"></script> <script type="text/javascript" charset="utf-8"> var picturesource; var destinationtype; document.addeventlistener("deviceready", ondeviceready, false); function ondeviceready(){ picturesource=navigator.camera.picturesourcetype; destinationtype=navigator.camera.destinationtype; } function onphotourisuccess(imageuri){ window.location.href = "review.html"; var image = document.getelementbyid('image'); image.style.display = 'block'; image.src = imageuri; } function getphoto(source){ navigator.camera.getpicture(onphotourisuccess, onfail, {quality: 50, destinationtype: destinationtype.file_uri, sourcetype: source}); } function onfail(msg){ alert('failed because: ' + msg); } </script> </head> <body> <button onclick="getphoto(picturesource.savedphotoalbum);">from photo album</button> <!--<img style="display:none;width:60px;height:60px;" id="image" src="" />--> </body> </html>
review.html
<!doctype html> <html> <head lang="en"> <meta charset="utf-8"> <title>review</title> </head> <body> <br> <img style="display:none;width:60px;height:60px;" id="image" src="" /> <script type="text/javascript" src="cordova.js"></script> <script type="text/javascript" src="js/index.js"></script> <script src="js/jquery-2.0.3.min.js"></script> </body> </html>
you can use html5 localstorage.
localstorage.seitem('url','your image path');
on next page access in
var myurl = localstorage.url