Transfer data from one JS file to Another without - javascript

I'm just experimenting with stuff.
I want to know how I can transfer data from one JS file to another without linking the two files i.e using the script tag on the same HTML file.
So, when I click a button on one HTML file ('file1.html'), it does something to another HTML file (file2.html).
I have used 'localStorage.set/getItem' which did what I wanted. However, when I put my files online, and try open 'file1.html' on the browser of my mobile phone, the 'file2.html' which is open on my pc, does not seem to update when I click the button on my mobile phone.
I'm sure 'localStorage' will not fulfill my require unless anyone can show me otherwise. Is there any way I could still update 'file2.html' which is on pc, with the button click of 'file1.html' which is on my mobile?
*It works when both files are open on pc using localStorage.
Thank you.

Related

How to download manually the HTML of a dynamic page

I need to download manually the HTML of a dynamic page.
I can't use a scraper because the site recognize me.
I tried to inspect the page, but in the Dev Tools I found no way to download the full HTML.
What should I do?
Pardon I'm quite newbie in Computer Science.
if you want to download the page just click these buttons on your keyboard
CTRL + S
That means you will save the current HTML page to your computer.
I hope it's clear and helpful, Thanks!.

All downloads from iframe go to folder in server

My website contains a iframe which allows the user to navigate the web. If the user clicks a download button on any website I would like it to download in a folder located on the servers itself. So if the user presses download on a image, the image is downloaded onto a folder on the server instead of the computer. Is this possible? I have no idea on how to go about doing this.
You seem to need to display a download button on any website...
You cannot modify all internet websites with your code.
The only way to go this is :
to create a browser extension, like this one : https://chrome.google.com/webstore/detail/image-downloader/cnpniohnfphhjihaiiggeabnkjhpaldj
This extension will be able to interact with any website and do what you want.
or (more simple to code) execute a Javascript of your own that will make floating a download button on any image of any website.
You can do this with this Chrome extension for example : https://chrome.google.com/webstore/detail/custom-javascript-for-web/poakhlngfciodnhlhhgnaaelnpjljija
You can also use a "download" button over the iframe that launch a curl Linux command that will download the iframe page and all the images, files etc...

is there a way to create a button that downloads the open html page?

I am creating a html page that is interactive. Sort of html5 app for my phone. I want to be able to save the session and transfer it between devices. The simplest way is to save the page while using it to some cloud service. The problem is that on mobile platform I don't have the save option in the menu. I can install an addon for that, but I wondered if I can add a button that does that for me.
So, how can I create a button in an html page that opens the currently open page (including the modifications).

Image button - print a document from my webpage

I have a website, but I need a button which I want to print a specific .pdf file from my webpage database.
As an example, this site
has a print button, which gives you option to print some pdf files
Any idea how can I do that?
I've tried this one, but it's not working:
<a href="../Documents/ScrittoGraffito/Scritto_Customers/Nicolaides_Optical/Nicolaides_webpage/Shop1_Banner.pdf"
onclick="window.print()"/><p class="test">link</p></a>
That code will tell the browser to open the print dialog for the current page.
If you want to force the browser to print the linked pdf then that is not possible, as it will be completely controlled by the application or plugin that handles pdf documents.
EDIT;
Apparently it is possible, but you have to make use of a pdf toolkit.

iFrame file upload with IE produces download dialogue

I'm developing a custom module for Drupal dealing with Document Management. At this point, the module loads, you can upload files (via a hidden iframe and some ajax requests), browse directories and set various levels of permissions. And everything works perfectly in Firefox.
Issue:
In IE however, I run into an issue. For some reason when I upload a file the save file dialogue pops up and asks me to download the file I just uploaded. It looks like it's asking me to download it from the web-servers tmp location however, as that seems to be the file-name and such. However, if I hit cancel and refresh the page I can see that the file I uploaded did actually get uploaded to the server.
Here is how the upload process works. Click the upload button. The upload button is the standard file input form element hidden and placed over a styled version of the button. Clicking on this causes the "Choose a file" dialogue to open.
Select a file and click "Open". A modal dialogue pops up asking you for some further information about the file. The modal is part of the same form element but remains invisible until you click Upload button
Clicking save in the modal causes the file to be uploaded. The "action" attribute on the form is pointed to a page and the target is the iframe.
The iFrame is polled a few times every second to see if it's contents have changed. When the file is uploaded a "success" message appears in the iframe. Since it belongs to the same domain, I scrape the content within the iframe.
Once the iFrame says that the file has been uploaded, I use some JS to update the application with the name of the file
Since I can't use Firebug in IE, I have to stick to utilizing Microsofts Web Developer Toolbar, which makes it very hard to figure out if the bolded step is actually occuring. It seems like it should, since the file IS being uploaded. It is just getting interrupted by that file download dialogue.
Since no one seems to have an answer, I'll post the fix I found. I doubt it's perfect, but it's the best solution I could come up with.
It turned out to be an issue with the polling as suspected. The fix ended up being instead of outputting json to the iFrame, just output some JavaScript that calls a function that updates the main window. That simple.

Categories

Resources