Topic: Is it possible to run some javascript code before browsing happens?

Is there any possibility, so that I able to execute some javascript code, when the user clicks on the browse button, before the browse window opens.

I think currently it's not possible in Plupload, if it's possible, then please reply.

If the above is possible, is it possible to stop the browser window before it opens?

Re: Is it possible to run some javascript code before browsing happens?

yes its posible you must capture onclick event for that button, (im using jquery for that), the other thing im not sure..
see my example for another inplementation
http://www.plupload.com/punbb/viewtopic … d=764#p764

Re: Is it possible to run some javascript code before browsing happens?

@geomorillo

As you suggested, we can have a similar looking button, which will be shown initially and we will hide the main browse button. As the user fills in the fields, we will validate them (on change). When all validations are correct, then we can hide the dummy browse button and show the original browse button.

In case the user clicks on the browse button, we can validate the fields (or we can have the error message saved in some variable while doing the auto validation) and show the user.

In this case, we don't need the answer my second question (stopping file browser to pop up).

Re: Is it possible to run some javascript code before browsing happens?

Word. I would love an event that is triggered by the clicking of the browse_button. You can capture the click event in gears and html4, but not in Flash and HTMl5, because those guys seem to absorb all clicks and don't pass the click downstream to your button.

So bindable event "BrowseClicked" or something would be delightful for the next release.

Re: Is it possible to run some javascript code before browsing happens?

Yes, been thinking of adding a mouse down/up/enter/leave for all plugins and bind those internally in flash. This way you can change the hover state of the flash upload button using a CSS class.

Re: Is it possible to run some javascript code before browsing happens?

I will look into that. That could be quite useful.

If you want to see your issue fixed, do not report it here, do it on - GitHub.

Re: Is it possible to run some javascript code before browsing happens?

I would also love to have this functionality.

By the way, I've tested event propagation on all modern browsers for html4, html5 and flash and found that, while html4 and html5 runtimes block mouse down/up event propagation, flash lets the events through.  So it is possible to catch mouse down and mouse up event by binding the appropriate event handler to the to the browse_button element for the flash runtime at least.  I haven't tested the other events mentioned by Spocke earlier or the other runtimes.

Re: Is it possible to run some javascript code before browsing happens?

Are you sure you are binding event handler to browse_button (which is then covered by flash object)? Never encountered any info on the web about flash being transparent to events. Do you got test case somewhere on the web?

If you want to see your issue fixed, do not report it here, do it on - GitHub.

Re: Is it possible to run some javascript code before browsing happens?

It's been a couple of months since I did the testing.  And my test application is quite complicated.  I did test the html5 and html4 runtimes with the same application and they did block mouseDown and mouseUp as expected, flash just worked (which surprised me).  I've been using all three runtimes for a few months and living with the limitations on mouseDown and mouseUp for html5/4, flash continues to work though.

I'll try to put together a simple example I can post in the next 3 or 4 days.

Re: Is it possible to run some javascript code before browsing happens?

That could very helpful. I'm very close now to start implementing this thing for Flash/Silverlight.

If you want to see your issue fixed, do not report it here, do it on - GitHub.