Programmatically open upload file dialog in Chrome - javascript

I have input[type=file] with log-in form on it. So after user logged in - file upload dialog instantly opened.
In all browsers I need (FF, IE10+) except Google Chrome, this call works perfect:
$('input[type=file]').click();
or
$('input[type=file]')[0].click();
or
$('input[type=file]').trigger('click');
Did anyone met this problem? If so, how to achieve this on Chrome?
Edit1:
https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement.click here in support it's said that I can use it on input[type=file].
Also this click is working, but only if I'll actually click something, that than is clicking my input(so only after physical click).
Edit2:
And yes, I've already tried search function. But everything I've found was old, and pretty much anyone told, that even FF is not supporting this (which is not true now).
Edit3:
Example test page: http://jsfiddle.net/Ux3t4/

This is not allowed due to security reasons. By the way, even in Internet Explorer (the dialog will be shown but once you select a file, the file won't be submitted).

Related

Chrome disabled javascript and doesn't allow to enable it

I am not able to enable javascript in Chrome. Under Chrome javascript setting the default option for "sites can use javascript" is grayed out. Even if I add website manually under "Allowed to use javascript" the website is not loading, screenshot below.
This happened while I was trying to find a solution for another issue and followed solution from this page (the top answer), so I went to Chrome Devtools > Sources and clicked on the pause button since then the javascript has got disabled. Paused in debugger in chrome?
Note: Javascript is working fine in other Chrome Profiles. The issue is with this particular Chrome Profile.
Try right-clicking the "Sites can use Javascript" option, and inspect element:
Then, remove the disabled or disabled="" attribute from whatever element the console brings you to.
The option should be enabled. Click it and try reloading your site again.
If this doesn't work, you can try reporting any problems for whatever chrome has (I use Mozilla Firefox and I know they have a help center).
Or try re-installing the browser, because some files may be corrupt (don't worry, if you have an account you can sign-in after the reinstallation and everything should be synced).

Opening browser's home page in other than IIE

I'm writing a bit of code to display an EU Cookie notification.
If the visitor does not accept the use of cookies, I want to take them somewhere else. My first thought was to take them to the browser's home page.
I found a way to do it in IE - I have been told that the method on that page is for IE 10 or less.
I have not found a way to do so in other browsers.
If this turns out to be more trouble than it is worth, I'll take them somewhere via a specific URL, such as www.google.com
Does anyone know of the method to accomplish the same thing in browsers such as Firefox, Safari, Chrome, etc?
Most browsers implement an address that will point to the home page. You should be able to redirect the user to the proper location after you figure out their browser.
For Chrome you can link them to about:newtab, which may be different from the home page, but it is probably the closest you will find. The actual homepage button is not implemented in Javascript and does not use a URL.
For Firefox you can link to about:home.
For Opera you can link to opera:speeddial. (I did not test this one, if someone wants to I'll update)
The documentation you linked to claims to be obsolete after IE10. I think you can link to about:home on IE same as Firefox if your solution isn't working afer IE10. (I did not test this one, if someone wants to I'll update).

Chrome JavaScript turned off

Okay, here's my problem. I wrote some JavaScript for a page, for some reason the page doesn't work in Chrome. The site does what I expect in Opera, Chromium and Firefox. In the Choom devtools there is a kind of error showing in the source tab showing "JavScript is disabled" in a mouse hover popup:
I turned off all chrome's extensions, Javascript in on in the content settings and I cleared all JavaScript exceptions I had, but this didn't seem to change anything. The weird thing (an other one) is that some other sites give the same alert icon in the devtools (including this one) but JavaScript works just fine.
If you perform the exact same functions in the console then, some of, the functions perform just fine.
Does anyone have an idea what I could be because I am out of idea's and it is really annoying that I have to switch browser to test the page (page is 'live' here). Thanks
Have you checked the DevTools settings? You might have accidentally enabled "Disable Javascript"

IE11: certain elements not being displayed, but after clearing history it works perfect

I've created a website which uses html5, jquery, php, etc. which works fine on Firefox and Google Chrome, but recently I've been experiencing problems with internet explorer 11.
The site first requires you to log in, after which it refreshes the page. The problem in IE11 (and possible earlier versions) is that some dynamic elements (like divs, tables, ...) are not being displayed, while others are.
Now, when I'm on the login page and delete my browser history (only history, not cookies or temporary files or such) and then login, the site works perfect, identical to firefox and google chrome.
Because of this, my guess is this isn't a programming problem, but something to do with loading scripts or such. The strange thing is that some functions do work from some file, yet others don't.
Does somebody know what might be the problem?

I have a very Unique issue with IE 7/8/9 and JavaScript Jquery

I have a very Unique problem with IE 7/8/9 and JavaScript. My problem is I am using a script called plupload - I am kinda married to the script currently and can't ditch it for something new and or better.
What my problem is, is when I add files to the script via the file dialog in IE and hit cancel instead of selecting a file. The button (well link that forms a button) seems to lose its functionality. This is only in IE, this has been tested across Mac, Linux 10.04 and 11.10, Windows XP, Vista, and Windows 7 (across about 17 different machines). On Chrome, Safari, Firefox and IE. This bug only occurs in IE on any windows platform. Does anyone know what might be causing the issue, anyone else ever use plupload that has experianced this?
To me it seems that the dialog takes focus off the browser, then doesn't give the the browser back focus properly unless you actually select a file. Seems at that point almost all javascript stops working but its really just the javascript that controls this button, which is pluploads own script.

Categories