Force download a picture from Google Chrome without opening new tab - google-chrome

We want to allow a user to download a picture via a button from our website. We've got the basic download working ok (it saves it to the disk) but we do it by opening up a new window...
window.open('mypicture', '_blank');
Unfortunately this creates a new tab in Chrome which does not go away. We don't have the most sophisticated users and they might become confused if the screen suddenly goes blank.
We tried it with...
location.href='mypicture'
This works great in IE, but in Chrome it just ignores the download completely.
Is there any other way to force download the picture without opening a new window?

Ideally, you should send http header in order to prompt the picture to be downloaded like
Content-Disposition: attachment; filename="downloaded.jpg"
..so you should point your link to a PHP script (or whatever), which sends a picture with proper headers.

Perhaps this is a bug in Chrome (FF too)? I just tried it with a link and it works fine.
Download

Related

Browser not responding to the changes made to my code

So I'm working on this web project for school and I use atom as editor and both chrome and opera as my browsers to view my work.
The problem is after few time refreshing the page to view my changes the browser does not respond and keep giving me the same old styling or contents I had on the page, I even had a registration form and every time I refresh it the page goes blank and I need to refresh it again in order to see it and when using chrome to view this same page, a confirmation dialogue pops up, I don't know what the problem is and I was wondering if someone can help me figuring it out. Thanks for your time.
Every time you save your file it auto refresh the page and shows the changed
Atom live server
open your web page in browser and reload by this Shift + Ctrl + R
It will refresh the whole page and show like first time opening.
(or)
check in private window of your browser...
You can see the css is reflected
If its a browser issue: Try Uninstalling and reinstalling chrome.
Check to make sure your looking at the right directory, many developers including myself make the mistake of looking at the wrong code base.

OneNote to open link in Chrome without Chrome being default

I have a very simple question I could not find answer for myself: I want links in OneNote to open in Chrome.
Note that the default browser is IE and I cannot change it (not admin etc).
Tried: "chrome_path url" - didn't work. Everything I could think about didn't work.
Please provide explicit solution so that link from within OneNote opens in Chrome rather than in IE.
To note, there are multiple links, so batch file won't do in this case.
Thank you in advance!
I had a little go with testing some ideas that I had though I'm very new to OneNote. It's easy enough to open Chrome from a hyperlink:
Select text to link
Add link
Select the file icon and navigate to chrome.exe. In my instance - C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
I believe you cannot pass arguments to the exe as it is considered a security issue. This certainly used to be the case and I'm not sure if they have modified their thinking since. The only way I can think of is to create a batch file which includes your ideal website and link to the batch file:
"start chrome http://www.youtube.com"
I found two ways to do it, though neither is the perfect:
There is a 3rd party OneNote add-on which adds more browsers in the right-click menu. Though it is not free and maybe can't be installed on restricted computers.
It works only on OneNote docs which are saved onto Onedrive. Open the OneNote page which has the links right in the Chrome, not in the desktop app. Then any links you click will open in the same browser. You can get the address of the OneNote page by clicking on 'Copy Link to Page' in OneNote app, then paste it to a notepad. Copy the first url to Chrome's address bar.
For those who has admin right, this problem can be solved by following Make Chrome your default browser. It is set at machine level, not onenote level.

Chrome can't see images that require username/password

So this is a weird problem, I am attempting to embed a video stream from a D-Link DCS-930L into a web page. My embed looks like this:
<img alt="" src="http://guest:password#192.0.0.10/video.cgi">
The problem is that Chrome displays a broken link image when I load the page, while Firefox and IE load it perfectly the first time.
But the really strange part is that if I right click on the broken image > Open link in new tab the stream loads, and then if I close the tab and refresh the page with the embed it loads there too! So it's definitely something to do with the username/password requirement.
I have also tried creating a user without a password but I see the same issue. There is no setting to disable this requirement in the 930L's control panel that I can find.
Does anyone know how to fix this? If not, is there a way to use PHP to execute a login automatically for the above kind of URLs?
This appears to be intentional behavior on Chrome's part since v19. Bummer.

Google Chrome source code reloading

How do I reload a page in Google Chrome, so the source code will not change?
In other words, if I change some text on the page with developer tools, and reload the page it loads the source code from the server. How can I reload the page so it will keep my previous changes I made?
To be more specific:
I enter a page
I edit content with Developer Tools
I press reload
I get the original version
As far as I know I must forbid Google Chrome to download source code from server or load a cached version, but how I to do that?
As far as i know isnt this possible, because when you press reload, Chrome automatically "deletes" your webpage that is shown at the moment and gets the source from the server again. You could try to save your changed webpage in the cache of a proxy server and then get it from there.

Internet Explorer Blocked download file

I use jquery post function to go to server and bring the link to file download.
When the func returns the link, I try to open a popup or iframe with link source, to popup save/open file window
I tried this
window.open(data.link,'Download','top=20,width=3,height=3,left=20');
and
document.getElementById('download').src=data.link;
It works in Firefox , but in Internet Explorer it shows the message : "To Help Protect Your Security, Internet Explorer Blocked.."
How do I get over this?
EDIT:
If I do it from direct link from the page it does not show me this message
This is due to IE's security settings. By default, IE automatically blocks any automatic downloads. There's no (legit anyway) way you can get around that except by changing the security settings of the browser. The user will be able to download the file by clicking on the bar that it displays, and click download file.
Well that looks like the popup blocker sort of behavior to me. I don't think you can do anything about this except use an alternative method to fetch the URL.
By the way, visitors are used to the Yellow bar and right clicking on it to get the correct download.
So I don't think you need to panic too much.
Edit:
You're not going to be able to change the security settings of everybody's browser. So either give up, or get by.