I have a page of my personal wallpaper thumbnails. Click on a thumbnail and the JS saves the info to localstorage, opens another page, and populates with localstorage. The image is ready to download using your smartphone screengrab feature. Click/tap on the image and it takes you to the previous page of thumbnails. That all works in the smartphone.
Why doesn’t it work on the PC? Console doesn’t have any error messages.
The image-grabbing script:
<script>
function grabFilename(filename) {
var filename = filename;
localStorage.setItem('wpName', filename); // name of wallpaper file
var mainFolder = "0trucks/0other-trucks"; // folder containing images
localStorage.setItem('wpMainFolder', mainFolder);
var mainHtml = "/0other-trucks.html"; // this page of thumbnails, in above folder
localStorage.setItem('wpMainHtml', mainHtml);
window.location = "../../wp_Show.html"; // open this page to display wallpaper
}
</script>
A sample thumbnail div:
<div class="tile">
<a href="#" onclick="grabFilename('truckname_768x1024')">
<img src="../../../thumbs/truckname_768x1024.png" alt="truckname"/><div class="title">truckname</div>
</a>
</div>
The page that opens to display the image:
<body>
<div id="output"></div>
<script>
var mainHtml = localStorage.getItem('wpMainHtml'); // return to this page
var folder = localStorage.getItem('wpMainFolder'); // folder containing images
var image = localStorage.getItem('wpName'); // name of wallpaper file
var output = document.getElementById("output"); // output to here
output.innerHTML = "<a href='" + folder + mainHtml + "'><img alt='' src='" + folder + "/" + image + ".jpg' width='100%' /></a>";
</script>
</body>