I have created a file using the FileSystem API. I can't open it from a simple link. However, I can open the page placing the URL manually in the browser (filesystem:http://localhost:8100/temporary/log.csv)
I'm testing only on google chrome for now.
window.open("filesystem:http://localhost:8100/temporary/log.csv")
I expect it to open in a new window.
UPDATE:
This issue was fixed by using window.URL.createObjectURL()
so the link will be something like blob:http://localhost:8100/7aa5685c-ca4f-485a-8bf8-d1c95e6257ab which works
If you know where in your filesystem is the root folder of your webserver (for example: d:\apache\www_root\temporary\) then copy your csv file to there.
Once its done, you should be able to open it from your Javascript by using:
window.open("http://localhost:8100/temporary/log.csv")
Same issue.
Using FileSystem API since the product is Chrome only.
How did you turn the FileEntry into the objectURL?
Figured it out
// turn fileEntry to file
fileEntry.file((f) => {
console.log(window.URL.createObjectURL(f));
});
Related
I want to create a vCard in the frontend and to make it downloadable (by clicking a button) in a ReactJs Project. I use a NodeJS module called vcards-js that creates a string with the content of the desired vCard (v3.0). The thing I am struggling with is to make it downloadable (as .vcf file). I have tried to achieve this with the modules react-file-download and file-saver but none of them worked properly. Last one worked fine on desktop, but did not manage to provide a download from mobile browsers. Chrome mobile opened a new tab and loaded forever, Safari mobile just opened the string in a new tap, but did not download it as a .vcf file.
Any clues or experiences? Do I need to create the vCard Server-side and provide a download link? Seems too circuitous to me.
If it helps, this is my file-saver approach:
var FileSaver = require('file-saver');
var blob = new Blob([card.getFormattedString()], {type: "text/x-vCard;charset=iso-8859-1"});
FileSaver.saveAs(blob, 'card.vcf');
I'm looking over the docs on vcardjs
https://github.com/enesser/vCards-js
you have to have a route on your backend on node to handle the process
It looks pretty intuitive
//save to file
vCard.saveToFile('./eric-nesser.vcf');
I was able to get this to work on vue.js by generating a vcf blob using the following code
var vcfBlob = new Blob(vcfBytes.split('\n').map(function(x) { return x + '\n' }));
and then passing that blob to a file saver
saveAs(vcfBlob, "hello world.vcf")
You might want to try generating it on the back-end, using NodeJS / TS package:
npm/ez-vcard; GitHub/Maxim-Mazurok/ez-vcard
Also, see readme and example for usage.
I found a cookies file in the location "C:\Users\Agnivesh\AppData\Local\Google\Chrome\User Data\Default".
I'm a little curious about the data in it.
I only see unformatted text when I opened the file in notepad.
Is there a way to open and see the contents of that file?
The most straight forward way to examine them is to open your developer window as you browse like below
Click F12-> then follow the tabs
Checked with Microsoft Edge: It's an sqlite file, which can be opened easily. e.g this link: https://inloop.github.io/sqlite-viewer/
Enjoy!
This will allow you to check out all of your cookies, not just the ones on specific websites.
(Found this out by trying to open with vs code, on the top of the file "SQLite format 3")
The problem is that the following external javascript file is not executing:
<script src="//www.google-analytics.com/cx/api.js?experiment=YOUR_EXPERIMENT_ID"></script>
When I access the URL directly it downloads the file as f.txt
And when I copy/paste the content from the file then it's fully functional js and working as it should: creating cxApi object.
Got the snippet from: https://developers.google.com/analytics/solutions/experiments-client-side
Presumably you are testing using a local file.
i.e. the URL in your browser's address bar is something like file:///Users/you/Desktop/test.html
The relative URL //www.google-analytics.com/cx/api.js?experiment=YOUR_EXPERIMENT_ID then resolves to file://www.google-analytics.com/cx/api.js?experiment=YOUR_EXPERIMENT_ID, which does not exist.
You may see an error in the Console of your browser's developer tools. You should see one in the Network tab.
Test using a web server. Access your pages over HTTP
Then you will have something like http://localhost/test.html, and the URL will resolve to http://www.google-analytics.com/cx/api.js?experiment=YOUR_EXPERIMENT_ID, which does exist.
How do you get html files in dropbox to open in a new window as an application, rather then opening it in the preview window. AgileBits the creators of 1Password for mac have a html page that they upload to dropbox and when open on dropbox's website it opens in a new tab and runs directly from your dropbox as an application.
I have tried a number of things and have not been able to recreate this, nor can I find any documentation on dropbox that says how to do it. If I take there html file and copy it, it works as expected. If I copy the content of the html into a new file, it only opens in a preview window. If I rename there file it no longer works, I search around for hidden .files and messed around with those but none of them seem to affect anything.
It might be just me but I think your question is phrased badly, however if I understand you correctly you want to essentially HOST a webpage/site from DropBox.
This is still possible, despite them phasing out the public folder in Aug 2012.
New accounts registered after this date need to manually enable the public folder by going here: http://www.dropbox.com/enable_public_folder
Inside the Public folder you can store almost anything (including HTML files) that can be accessed directly with an absolute URL.
You want to open the https://dl-web.dropbox.com/get/*folders*/*file.ext*?_subject_uid=*9999999*&w=*abcdefghijklmnopqrstuvwxyzABCDEFGHIJK123456789* link for a non-public folder file (rather than the https://www.dropbox.com/home/*folders*?preview=*file.ext* link). This is actually the link for the anchor tag for the file in the file list on the web, but clicking on most opens the files in preview mode (still not sure why ones named "1password.html" are exempt). To open the non-preview link you can Shift-Right-Click, to get the browser right click menu instead of the Dropbox one, and just chose "Open in new tab/window".
Using the 1password.html file as a guide it looks like you can load separate scripts/files using ajax. They embed all CSS and images in the HTML file (images using base64).
Edit: It looks like Dropbox provides special functionality to 1password. Other non-public pages can not load scripts/data from the same folder tree (error 403). Even renaming the 1password.agilekeychain folder and breaks its functionality.
Is there a way to get a browser to read a .pac file without having the user manually point the browser's automatic config file at the URL?
Are you talking about Proxy Autoconfiguration?
Basically you have to configure a host name such as wpad.example.com and put the file there named as wpad.dat
See here: http://en.wikipedia.org/wiki/Web_Proxy_Autodiscovery_Protocol
If you are using Chrome then you can use the chrome switch --proxy-pac-url
For example:
Open cmd.exe as admin
Make sure to first navigate to the path of Chrome (1st line) in cmd
Notice also that I used another chrome switch which is unsafe-pac-url this will allow your pac file to work for HTTPS requests, because otherwise chrome will only apply our PAC file to HTTP requests only.