Unpacking the mystery of the cdvfile:// protocol

I am currently working on a Cordova App and I am using

<img class="profile-thumbnail" src="cdvfile://localhost/persistent/Photo/mypicture.jpg">
to display content in the view.

However, when I generate a new mypicture.jpg file using the file API to overwrite the existing one, the picture disappears from the view and does not come back until I kill and relaunch the app.

I have tried updating the image source with

$('.profile-thumbnail').attr('src','cdvfile://localhost/persistent/Photo/mypicture.jpg');
after a successful storage call, but the correct picture is still not displayed immediately after the update.

The new file is only displayed properly after relaunching the app. How does the cdvfile:// protocol handle updates? Is there a cache that needs to be flushed after updating the file?

Are there any recommended techniques for handling this type of request?

Answer №1

After some investigation, I pinpointed the problem to how I was saving the updated image. Although I had created the file, my method of writing the picture into it was incorrect, resulting in an empty file being displayed.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

When selectRowAtIndexPath is called, a custom UITableViewCell's appearance changes back to the default blue cell

My custom subclass of UITableViewCell is equipped with unique styling and additional data. While everything functions as expected when the user engages with it, the issue arises when I programmatically select it using selectRowAtIndexPath; it reverts back ...

Issue with Aligning Elements Horizontally

I am looking to align this content at the center horizontally: <a href='/large.jpg' class='cloud-zoom' id='zoom1' rel=""> <img src="/small.jpg" alt='' title="Optional title display" /> ...

How can I retrieve the identifier in Socket.io?

Is there a way to retrieve the unique Id from the server using socket.io? I attempted using clients[socket.id] = socket; However, I encountered an error stating: connections property is deprecated. use getconnections() method Does anyone have any sugg ...

Establishing the module exports for the NextJS configuration file

I have explored different solutions for adding multiple plugins to the next.js config file, with composition being the suggested method. However, I am encountering issues with this approach. const Dotenv = require('dotenv-webpack'); const withSt ...

Why won't the jQuery function trigger when I click, but only responds when I move the cursor?

I am currently working on a website that includes a basic CSS style switcher. The function responsible for handling the theme button clicks is shown below: <script> $(function() { $(".light").click(function(){ $("link").attr("href", ...

Is it necessary for me to upload the binary again following an appeal?

I recently uploaded my app to the app store without any problems. It was reviewed successfully. However, after an update, my app was rejected due to the following reason: 2.12: Apps that are not very useful, are simply web sites bundled as apps, or do not ...

What is the proper method for appending a string to the id of a React JSX div element?

Is it possible to dynamically change the id of a div in JSX using the following code snippet? { ['A','B','C','D'].map((element, cell) => ( <div id="alphabet_{element}"> Some </div> )) ...

Replace the facebook plugin using JQuery libraries

Does anyone know how to remove the like button on top of the 'Like box' Facebook plugin using JQuery? I have imported the like box from Facebook and I want to eliminate this like button, but Facebook does not allow me to do so. Therefore, I am t ...

Disregarding NPM dependencies for individual packages

I need to include a package (d3.js) in my project's package.json. However, when I run npm install, I do not want npm to install any dependencies related to d3.js or run any install scripts for it. Essentially, I want npm to only fetch and unpack the p ...

Learn how to use Bootstrap to position my component below another component on the webpage

Understanding the basics of Bootstrap and how to assign sizes to columns is one thing, but I seem to be stuck on a simple use case. Here is the scenario: I have two components for a Todo list application: Component 'New Todo' (Form Input field ...

What could be causing this Facebook javascript-sdk login code to repeatedly log in the user automatically?

After pressing the logout button on my site, I am still unable to keep a user logged out. Although they are redirected to the login page, the updateButton function is called again with the same credentials causing them to be logged back in. Despite trying ...

JavaScript Paint Brush Tool Powered by HTML5

I am looking to create a smooth and clean opacity brush. Here is an example of the drawing line I want: This is the second picture I managed to achieve: When I move the cursor quickly, there are fewer circles in the drawing line. ...

Tips for modifying the Background Color and Placeholder placement in a UISearchBar

https://i.sstatic.net/fIU1g.png My goal is to incorporate a UISearchBar on the storyboard, but I am finding limited options for setting the background color and text placeholder. Is there a way to achieve this without coding? ...

Best practices for server side countdown implementation

Issue I am facing a challenge with displaying a server-side countdown on the client side. Initially, I set it up using socket.io to emit data every 100 milliseconds. While I like this approach, I am concerned about potential performance issues. On the o ...

Transferring data-id to a Bootstrap modal without the use of jQuery

I've come across numerous questions similar to this, all suggesting the same solution of using JQuery. However, incorporating JQuery into my Reactjs project just to pass an id to a modal is something I wish to avoid. Below is my code snippet : <! ...

In JavaScript, the mousedown event consistently receives the "e" parameter as the event object

I am facing an issue while trying to handle a middle mouse button click event using JQuery on a DataTable from the website https://datatables.net/. Below is the code I have implemented. var tbl = document.getElementById("entries"); $(tbl).on('mousedo ...

Looking to trigger a PHP page by clicking on a div?

Is there a way to trigger a PHP page call when a user clicks on a <DIV> with AJAX? Additionally, can the text of the DIV be changed to display "LOADING....." simultaneously? I lack knowledge about AJAX. Could you please provide me with more details ...

Google App Script - Mapping Error - TypeError: Property 'map' is not defined for this object

Thanks to the amazing insight from the community, I recently discovered this helpful tip on BatchUpdating background colors of a specific google sheet. Excited to apply this to my own sheet, I encountered an error saying: TypeError: Cannot read property & ...

Exploring the world of Flutter: Background discovery of Bluetooth devices (using flutter_bluetooth_serial)

I am looking to implement a continuous Bluetooth device search in the background that will notify me once a specific device "X" is detected. Currently, I have a timer set to run every 5 seconds to perform a new scan. Is there a way to perform this scan e ...

Converting an Android project using JUniversal for translation

I recently started using JUniversal to convert Java classes from an Android project into Objective-C. Following the installation of J2Objc and cloning juniversal and jsimple on Mac OS X (Yosemite) from this Link, I encountered an error when running the com ...