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.
Related
I have a published Web App developed with Apps Script. This app has an input field to upload a file. It takes about 10s until the file is completely uploaded. If I click on any other existing input field on the page while the file is uploading, the page moves out of screen and becomes visible only part of it or sometimes I get a blank screen (it depends of which input field was clicked). The page comes back to normal only when the file is uploaded completely.
I have figured out that if I disable Site Isolation in Chrome (chrome://flags/#site-isolation-trial-opt-out) then page is displayed correctly. Also it is working fine with Internet Explorer.
Here are some screenshots.
Select a file and click button to upload
While the file is uploading
How the page is displayed after any of input fields was clicked
Any help would be appreciated.
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.
I have a landing page on which there is a form which is filled by user and then it goes to a thank you page (which is another page). On thank you page I simply want to prompt the user for saving a pdf as the thank you page loads. Please note I want the file to be saved/downloaded and not opened on the same tab or another tab in the browser. I have tried multiple solutions but they all seem to open the pdf in the browser itself and not download it. Some of the methods I have tried are meta tag download, page redirect download, iframe download but they all open the pdf in browser itself and not download it. I just want a simple solution for downloading the file and not opening it in the browser. Also the pdf should download automatically without clicking any link or button.
The document.ready event of the thank you page should trigger a local script that runs a server script to download the PDF. Be sure to set the headers as described above. If you try to link directly to the PDF, it'll try to load in the browser.
Alternatively, you could create the PDF in a directory that is already set to only download files by setting the .htaccess file for that directory.
I am working on a chrome extension and I am stuck. I am not sure if this is even possible but this is what I need to have done. Basically the user click on the chrome extension and panel opens up (popup.html). The user is shown a list of images from the web and the user can select the ones they want to edit. popup.html loads popup.js. popup.js contains functions and inside those functions are some variable. Now there is a button in popup.html that takes you to another panel called filters.html. This is where editing goes. I am trying to pass the selected images from popup.html to filters.html and I am trying to call that array of images that was gathered in popup.js when popup.html loaded but its null. What is wrong is this even possible? When a new html page opens up does that mean it loses track of what happened in the last html page and therefore it loses also track of whatever .js files ran in that same page?
A new and better way is to use chrome extension storage. You can store the data from one page and u can read it in other page as data will be stored in chrome itself. Hope it helps
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.