I have a link to a URL that returns a download PDF dialog box
It takes about 30 seconds to load so I would like to present some visual indication to the user that they've clicked the button and that the PDF has been requested.
As the PDF loads in a dialog box so it can be saved, the user isn't redirected to another URL in their browser. After they've clicked the save the PDF they remain on the same page.
Is there anything I can do with Javascript (or jQuery) to detect when the PDF has loaded and the dialog box has been presented? If so, then when I receive this event then I can hide the loading icon that I'd like to display when the link is first clicked.
Related
i am developing a website, in our website we have a Video player, and a Download button. When user click to it, it will download the video to user machine.
Usually this can be done if user right click and choose Save Video as. Then a native browser dialog open, where user can choose destination and file name, then click save. After that in the bottom of the browser there will be a widget to show progress, and user can click to open after it finishes downloading
Now my question is it possible if we create a similiar functional widget but in the website. So basically after user clicking Download. This modal will appear in the bottom left of the page
Then after downloading is finished, it will change to
So to sum up the requirement for this
1/ Trigger download automatically by JS without right click and choose Save video as
2/ Showing a custom progress of downloading
3/ When downloading is finished, there is a custom button, where user can click to Open
4/ [Optional] Hide the native progress/click to open widget of the browser
So these requirement i still not sure which one is possible and which one is not, so hopefully if someone can give me a direction, thanks
This is the window that appears for printing in browser. This windows appear after opening on a PDF page in a browser. Also this window is next stop after clicking print button in a PDF file generated by FPDF. I am using FPDF and I believe you cant output or add other things aside from your data so Close window automatically after printing dialog closes solution is not valid for my problem. This solution basically add a JS script in the pop up window.
Is there a way to close this window after clicking on the PRINT BUTTON for PDF pages. For PDF generated by FPDF?
I am building a Chrome Extension for ,my Bookmarks app.
A bookmark record has 4 images fields.
Each image filed has these options to set an image:
Generate a screenshot of the viewport of the webpage
select an image scraped from the webpage HTML
Select a region of the webpage screen and then edit it with annotations
Orginally I had a modal style app that loaded in the popup.html file when the extension button was clicked in the toolbar. Because I added the ability to select a region for the screenshot image though I now have to move that modal into the actual webpage DOM.
The reason is that when a user select to select a region screenshot from the modal, it has to close the modal/hide it and show the screen to make the selection. On completion there is no way to re-open the popup from the menu bar!
So I am moving the modal to the webpage. Clicking the toolbar button will then build and show the modal. Then when user selects to select region for 1 of the 4 image fields, I will hide the modal and on completion I can simply show the hidden modal and populate a text input filed with the newly generated and uploaded image.
I am now trying to go a step further though. After selecting the image region, instead of showing the Modal window right away. I want to instead show the image in an editor style page which would be an HTML webpage that belonged to the extension (like this chrome-extension://mcbpblocgmgfnpjjppndjkmgjaogfceg/fsCaptured.html). It would open this in a new tab.
The user would then annotate with text, shapes, etc in the editor and then upload file.
This is where I am stuck. When I get the URL back from the uploaded image, I need to then close this new tab window and go back to the main webpage that had the app modal window and where the screenshot selection was made from. I would need to then open/show the modal again and fill in the text input for the new image upload field.
So my question here is...
Is it possibble for my extension to pass a message from my chrome-extension://mcbpblocgmgfnpjjppndjkmgjaogfceg/fsCaptured.html page with the editor back to the webpage the modal is on?
I would need to:
Pass the image URL back to the webpage with a message
Close the extension editor page/tab
go back to/bring focus to the webpage with the modal on it
Is this even possibble? I realize you can send messages from background scripts to content scripts and content scripts back to background scripts.
UPDATE
For the first part. Perhaps the extension webpage would send a message to the background.js and then the background.js could send a message to the webpage content script. This would solve that part of the process!
Would just need to figure out if the extension webpage can close itself and then bring focus to the original webpage?
Update 2
Looks like I figured it out.
You can make a tab selected/active with:
chrome.tabs.update(tabId, {selected: true});
I believe my custom extension page can send a message to the background.js
and then the background.js could send a message to the webpage content script with the modal window and have it then update the image fields in that modal.
Next from my custom extension page I should be able to call chrome.tabs.update(tabId, {selected: true}); after it sends the above message to the content script which would then close the extension page and bring focus back to my webpage with the modal in it.
I have an object tag which loads a flash into the page. And if I click a button, this flash will append to a display popup box.
//first load
<object data="url.swf"></object>
//after alick will be appended to a div popup box
<div><object data="url.swf"></object></div>
In chrome and Firefox, the object will be reload after I append it into the popup box, and I need this reload action to show some information.
//after load
alert('have loaded')
However, In IE, there isn't any reload action, the information will not show. How I can reload the object manually
I'm currently trying to write an extension for Google Chrome, which can be used to upload files.
There are two pages: the background page and the popup page.
The popup page appears when you click the icon right of the omni-bar. You can specify the file you want to upload using the standard HTML <input type='file' ... />.
After selecting the file, and clicking "Upload", the name(+path) of the file should be sent to the background page. This, because the popup can be closed by the user by simply clicking somewhere else on the screen, which closes the page.
When the popup is active, and the background page is uploading the file to the server, the popup should also recieve the progress of uploading(0-100%) from the background page, and display this information. When finished, the user should see the URL.
The problem is, I don't know how to communicate between these two pages. The documentation isn't very clear about how this works. A thing I've tried, is making a function on the background page, called upload(filename), and put this code in the popup page:
var BGPage = chrome.extension.getBackgroundPage();
BGPage.upload(the_filename);
But it didn't work, the function wasn't called.
Does anyone know how I can send the filename from the popup page to the background page, and how to retrieve upload status(and eventually the link) from the background page, via the popup page?
Thanks in advance!
Define it as a variable.
background.js
upload = function(fileName) {
console.log('Uploading', fileName);
}
popup.html
<script src="popup.js"></script>
popup.js
var BGPage = chrome.extension.getBackgroundPage();
BGPage.upload(the_filename);
That should work. If it doesn't, then check your inspector for the popup and background page:
Popup Inspector: Right click on the popup and choose Inspect
Background Inspector In your extension settings page chrome://extensions, turn on developer mode (check top right), and click on background.js.
It will open the inspector, then click on console to see the error messages in the console to assist you further, doing what I stated above should work, I do it all the time.