Run by the Ministry of Foreign Affairs (mid.ru), the web-site https://zp.midpass.ru/ lets one fill in various information in order to get a passport, and then print out all of these details right from the browser, along with a QR code to bring to the consulate, which supposedly has every single piece of information from the form encoded within it.
They claim that none of the operations, other than the passport photo upload, are performed through their server, and all data is saved locally. (E.g. anyone can try it out, without having to register etc.)
However, they don't seem to require any specific browser versions or anything, seemingly working everywhere.
How does it all work? Where do they save all of this data? Is there a way to export it, and import it into another browser / computer, other than printing it outright?
They use Local Storage. Using Chrome Developer Console I can go to the Resources tab and see that it stores that data using Local Storage after I click on "Save unfiled profile" - Google Translate.
Related
I wrote an Excel add-in using the OfficeJS API about a year and a half ago and it has been working until about two weeks ago. It seems like Excel has had an update where I'm now allowed to right click on the taskpane and see dev tools, where I wasn't able to do that before and had to run an external MS Edge devtools application for debugging. This seems like a relatively new issue and I can't seem to find any information about it. I tried reducing MS Edge's Tracking prevention settings to the Basic setting as seen below:
I gave javascript permission to appsforoffice.microsoft.com since devtools is saying it's blocking this this file specifically https://appsforoffice.microsoft.com/lib/1.1/hosted/office.js in the console. I also included just microsoft.com as well as the company's URL and cdn url. I also added localhost since this is happening locally on my computer too. I can't seem to change any blocking settings in Excel specifically, but my assumption is that excel runs an instance of Edge for the add-in since I can track it in Edge devtools.
I read the article found here https://learn.microsoft.com/en-us/microsoft-edge/web-platform/tracking-prevention in order to see what I could change, but none of the solutions here worked for me. It almost seems like the settings for Edge aren't getting read into Excel so it always blocks any application that attmeps to read from localStorage/sessionStorage.
I use sessionStorage in my add-in to write data to to read back out and tried localStorage too, but I still get the same error.
Even stranger, the data I'm attempting to read out is from data I've written to the storage and can see that it's been written with no problem when I look at the storage tab in devtools so the problem is limited to just reading from the storage.
Does anyone know where the changes to the tracking needs to be made for Excel add-ins to be able to read from the storage if these changes don't get updated from MS Edge or if there is a new bug that was released with Excel recently?
EDIT: To be more clear about the exact issue, my add in basically reads text and values from the cells and based on tags I've defined for the users, these values will be output in an HTML element containing the tags the user wants to generate. For example, when a user wants a paragraph, they can mark a cells with /para and /end para and any text and values in the rows/cells between that will be output in an HTML paragraph tag. They can also build out HTML tables like this. During the process of reading in the text and values, this all gets built out into a string called previewString that I store in sessionStorage so a Dialog window can open and read previewString from sessionStorage and will be the completed HTML the user wants to generate. All of this has been working now for about a year and a half, but now when attempting to generate the HTML, I can see the string is stored in sessionStorage as shown in the screen shot below:
However, when the dialog window opens, the data is not in the sessionStorage so it can't be read and it still has the error Tracking Prevention blocked access to storage for https://appsforoffice.microsoft.com/lib/1.1/hosted/office.js as well as a Permission Denied error.
previewString is not available in the sessionStorage tab for this dialog
SECOND EDIT: I searched the error code the console was giving OSF.DDA.ERROR code 7000, permission denied and found this post on SO Office JS Api - Permission Denied Issue. This appears to have been a bug in the past, but I'm not sure if this is the case again or not.
Recently, I also faced the same issue where I was getting OSF.DDA.ERROR and "Tracking Prevention blocked access to storage for" error.
I was able to resolve it after adding a setTimeout(function(){},1000) to my code and write my Office specific code inside it.
Adding setTimeout() helped me solve this issue. I also tried Office.onReady, but that didn't work for me.
It is trying to access Office specific functions before it fully loads.
I remember several years ago that I was able to save a remote JavaScript file from a website onto my local in Chrome Debugger, make a few code adjustments, and refresh the page so Chrome will be reading the local copy of the JS file. I am wondering if this feature is still available, and if so how am I able to use it?
I know that I can add breakpoints to achieve something similar. I have followed a few guides, but none of them was able to achieve what I want:
https://developers.google.com/web/tools/setup/setup-workflow?hl=en
https://www.sitepoint.com/edit-source-files-in-chrome/
It looks as though you can only achieve this when you are using a local server. According to the Stage persisted changes section of the API:
If you are mapping files from a remote server instead of a local server, when you refresh the page, Chrome reloads the page from the remote server. Your changes still persist to disk and are reapplied if you continue editing in Workspaces.
It seems you could achieve what you want if you use Fiddler AutoResponder:
Fiddler's AutoResponder tab allows you to return files from your local disk instead of transmitting the request to the server.
I have read many articles and answers here regarding this but nothing can solve my issue. That's why I am asking this question again.
I develop a Invoice App in Asp.net. I can't print invoice directly on client PC. It always ask printer preview that irritate client. I have successfully develop a code for directly printing but it only execute on local host only.
Please help me and suggest me what to do as soon as possible.
In Javascript or ASP.NET or something else that can help me.
We use SSRS and generate the report in pdf format on the server. Sending it to the client, we send it with a mime-type:application/x-xyz-printpdf - you also have to set the content-disposition: with filename and I can't recall if inline or attachment value, so that the browser will behave and not simply download and save the file, but will kick off the associated program
the client has a slightly modified version of SumatraPDF, which is associated with application/x-xyz-printpdf in the registry (windows clients only - there's ways to do this in other OS's but all our clients run Windows, so we've never bothered)
This modified sumatraPDF never displays the document, all it does is display a print dialog with the previously selected printer for the report selected. This is so, invoices will default to one printer, other reports to a different printer, it's more of a convenience (and emulates our old non-web-based application)
I am in the process of rewriting the report printing subsystem, using a substantially modified version of PDFjs and blobs, but that's in early development so I can't tell you anything about that, except that it looks like it'll work well, without the need for an external program.
Background:
I have built an offline HTML5 application that stores some data into the local browser db using pouchdb.
Now the requirements have changed and I have to store large pdf documents(around 200 of them, each with 5mb - 8mb size) into the local browser so the user can view it offline when required.
Issue:
I don't think that it is a good idea to put these large documents received from server into my in browser database using pouchdb.
I would like to know if there is a way to put these documents into my device some how and then get a url reference pointing to the location within the local device ?.
Include the PDFs in your offline manifest, so that they're cached with the rest of the application. Then you just use your normal URL to refer to it, and it's satisfied from the offline app cache.
Re your question below:
When the application is loaded in the browser then i store the details of the associated pages into the browser via a manifest file. And when the user clicks on a 'SYNC' button then I communicate with the server and fetches all the pdfs associated with the user. If I have to persist these pdfs using the manifest then how can I do it ?.....the manifest is already stored
The way we do something similar is this: We have separate pages for the things that the user has taken offline (a day's worth of appointments, for instance), and a list page driven entirely by client-side data that lists those pages. Here's how it works:
When the user wants to take something they're looking at offline, they click a button which opens a URL with the information telling the server what they want (say, example.com/offline/stuff-saying-what-they-want-here/), and the server generates a page with that data embedded in it along with a manifest for the page and any assets it requires. So at that point, that information is available offline on that URL. When it loads, the page registers itself in a list in localStorage, giving a description of the page and its URL.
The list page (say, example.com/offline/list/) has its own manifest and assets, which don't change often because it's driven entirely by that localStorage information. It shows the list of things they have offline with links to them. It's primarily a convenience for users, in case they forget to bookmark the individual things they take offline; e.g., the idea is that they'll bookmark the list once, and never have to worry about bookmarking individual pages. (They could go hunting through their history, but it's a pain.) The list page keeps itself up-to-date by getting the list of known pages from localStorage when it loads, and subscribing to the storage event so if you load other pages in other tabs while the list is open, it sees them arrive and updates its list.
So without knowing anything about your app, it sounds like perhaps your main page could be like or list page, and clicking "sync" could open a page for the PDF, generating the manifest on the fly, and that page could register the PDF in localStorage the way we do with our offline pages so the main page can show their status correctly.
Obviously, there's potential there for the actual appcache and our localStorage list to get out of sync; we can't help it if a user clears appcache (which would make us list things that can't really be viewed offline) or clears localStorage (which would make is not list things they could view offline), but there we are. Users mostly don't do that, all that often.
In the future, you'll get much more granularity and control with service workers, but for now since service worker support is very thin on the ground so far, we're stuck with appcache and its fairly stodgy way of defining offline assets.
T.J. Crowder is right: if your PDFs are static and known in advance, then AppCache is the way to go. Unfortunately it does mean that each and every PDF will be saved in the user's browser when they first load the site, but maybe that's what you want.
Else if the PDFs are dynamic and not known in advance, then yeah, you may see performance problems from PouchDB with 5MB attachments. But if you want to try it out, then check out PouchDB attachments and blob-util. blobUtil.createObjectURL() is exactly what you're looking for in terms of a "local URL."
I am working on a Chrome extension that needs to save some information (tabs info mainly) that will exist throughout the lifetime of the extension (e.g , since the user starts using it until he closes the browser).
One option is to use localstorage, however localstorage can only save Strings and that makes it very uncomfortable for me (since I have a bunch of data to save - dates , URLs , integers etc). What I'm looking for is using my own javascript objects that will live throughout the time of the extension.
Now the problem is that defining these objects in a script in some javascript files will erase them each time the user clicks on the browser action . In other words I have a browser action called popup.html that includes a javascript file (in which I want to save my objects) and every time the user clicks on the browser action all the objects I defined in the JS file are lost, yet I want everything to be persisted .
What option do I have to keep data that persists through many clicks on the browser action and that is NOT localstorage?
You really should use localStorage (you may use JSON.stringify and JSON.parse).
If you really don't want to use localStorage nor a server side storage, use IndexedDb : https://developer.mozilla.org/en/IndexedDB/Using_IndexedDB
Try using the Filesystem API's persistent storage. That is more reliable than localStorage. localStorage will be cleared once the user clears the cache, cookies etc. Filesystem is more reliable.
This answer about using chrome.storage worked for me far better than the others.
https://stackoverflow.com/a/14009240/766115
It's like localStorage, but works between the popup / background and content scripts.