gmail type filechooser for firefox - javascript

I have a simple requirement:
One browse button opens multiple file choosers.
When file is chosen, its filename gets added to an order list.
This works just fine in IE, because i can programatically click on hidden file inputs, but firefox does not let the click event open the file choose dialog.
Question:
What options do i have? I noticed that gmail uses a piece of flash to make this happen, this isnt really an option for me, i need to stick to an html/javascript solution if possible.
Thanks.

There's a reason GMail uses a piece of Flash: it is the best least-worst option. Some other sites I've seen use Java applets or their own browser add-on or Active-X component, which I find much more intrusive to the user than Flash.
If it were possible with HTML/javascript, you wouldn't see so many sites (like GMail) going out of their way to use flash or Java.
If you're stuck to HTML/Javasctipt, the next best thing you can do is the way GMail used to do it: put an "attach another file" link below the file selection input field, when the user clicks it another file selection input field is added to the page with javascript, so that they can add an unlimited number of files without navigating away from the page, but they still have to pick them one at a time.

There is not much you can do aside from Flash because the file input fields have been locked down for security over the past few years. If you want, there are several freely available Flash uploaders that will do the trick you want.

impossible Based on your data (users not having Flash) this is not possible with just HTML and Javascript. has alway been a huge debate whether to improve it or not. It doesn't even support too much CSS styling.
Multiple file uploads are able only via plugins. Either Flash, Java or Silverlight nowadays.

Related

Javascript to move selected web text to MS Word

Im annoyed that this doesn't seem possible, but i wanted to check with the community to see if someone has developed a working version of something similar.
I'm a graduate student and spend a LOT of time online researching, and when I find that sweet paragraph that makes just the argument I've been searching for, I've gotta copy and paste it out of chrome (on mac os x) and into word (2011). I've built a "strip all formatting" macro that works well enough, but what i would like is a pipe from chrome into my open word document that gives me 1 key "send selection to word document" (like ~).
I've got the js working to get selected text and move it around, but i cannot seem to open the document i want to move the text into. Ideally, this would work as a chrome plugin (I've built them before), but I've seen no documentation about JS => Word on other platforms (obviously activeX controls dont work for me).
Any suggestions?
You can use an automator service to do this. Open Applications > Automator, and then create a service, which receives selected text (one of the built in defaults). This works in any app, and is accessible via the Services menu when you right click.
You can do this easily with TextEdit for example using these two actions:
Service receives selected text
New Textedit Document.
I've just tried it to confirm it. It can also copy rich text etc (including links) if you want. I imagine something similar is possible with word, and there is a built in service already to do the same if you have installed TextWrangler (another word processor).
JavaScript is contained within the browser for security reasons, so you will not be able to do it with JavaScript.
The best thing that i can come up with is to write a 'bot' kinda thing that just coppy pastes, so not for in an extention.

How to make the HTML page view source UNREADABLE?

We have an option of disabling the right click event on the HTML page at same user can click on view menu > source and can get a copy of the content displayed.
How do i make it into unreadable format? Just like when you do a google search and see the source of page very similar to it? How can this be done?
You can't. You can obfuscate the scripting and minify the html (remove all unnecesary whitespace) that's what google does). So, making the readability of the html (by obfuscation, minification) more difficult is the best option (if you must).
You can also go flash ofcourse, like in this website
How do i make it into unreadable format? well you can't change the format, its plaintext, this is how the browser expects AFAIK, when gmail first came out, its source code was sort of hidden, what they did actually is have the entire source of the page rendered using hidden iframes and JS, as such users would right click and get <!DOCTYPE html><html><head></head><body><div></div></body></html> but this is no longer the case.
how does Gmail hide its source
Try to compress the code using this site http://www.textfixer.com/html/compress-html-compression.php
It will remove all the whitespace and compress the code to make it unreadable.

How to disable Export to Microsoft Excel in the IE browser right click?

Is there any option to disable the Export to Microsoft Excel menu in the IE browser right click.
I tried the web.config method and also changing the system registry using regedit.exe
As i want this menu to be disabled to users who are accessing my application.
The ability to Export to Microsoft Excel is a feature of Internet Explorer and is turned on by a registry setting. Therefore, from your web application you will not be able to prevent this behavior in any meaningful way.
"i dont want the user to access my data."
If you don't want the user to access your data, don't put it on a public website. Exporting it to Excel is just a tiny shortcut, copying and pasting can do the same thing. And please don't even start to think about disabling copy and paste.
The golden rule of data on the web: Once it's out there, it's out there.
You can probably generate your pages as images so that user can't export or copy. But then you will probably have to disable PrintScreen button so that users can't OCR your text.
Some time ago online book readers fought to prevent users from copying the book text. E.g. they used JavaScript-generated text, and I think stuff like absolutely-positioned letters instead of plain text. But they lost this fight. And you will.

Javascript context menu for images

I have a website where lots of people copy images off it, which is fine. What I do want to do, however, is help them embed it on the target website they are going to.
Ideally this would take the form where when a user right clicks the image a context menu will appear giving them easy options to embed or share the image.
What is the best way to do this?
P.s. I don't care about them hotlinking, or saving the images at all, all I want to do is provide the user with an easier way to share the images!
Don't send the image to their browser.
No. You can prevent the common user from bothering, but the fact is the URL is sent to the browser to download. So at the very least I could view the source and figure it out.
If you really want to try to annoy the user, though, you can attach an oncontextmenu event which will capture the right-click in some browsers.
edit:
In response to your comment..
Since you're using jQuery, you can use this plugin to detect right clicks. It has been tested on most browsers.
You can then use something like SimpleModal to display the modal box you want to show the user..
$('img').rightClick(function (e) {
$.modal(...);
});
You can actually render HTML as embedded mime data in all major browsers except for IE:
http://jimbojw.com/wiki/index.php?title=Data_URIs_and_Inline_Images
Another weird, but workable solution is to convert the image to CSS:
http://elliottback.com/wp/convert-image-to-css/
Neither is really that great a solution, but it highlights the fact that you need to be willing to lose an image by just putting on the web.
Even if you use a plug-in, people can just do a screen capture.

What happens to my web application if JavaScript is disabled?

I'm learning jQuery and am about to write some pages using intensively that library. I just learned that some user disable JavaScript on their browser (I didn't even know that was possible and/or necessary).
Now, here's my question: What happens to my web application if a user disable JavaScript? For instance, I'd like to display some screens using AJAX and commands such as 'InsertBefore' to bring in live a DIV that will display the result.
So, if JavaScript is disabled, I wonder what going to happen to all this work that relies on JavaScript?
I'm kind of lost.
Thanks for helping
You may want to start by reading on Progressive Enhancement and Unobtrusive JavaScript.
I would also suggest to investigate how popular rich web applications like GMail, Google Maps and others, handle these situations.
I just learned that some user disable javascript on their browser
I do. The "NoScript" plugin for FireFox does the trick.
So, if Javascript is disabled, I wonder what going to happen to all this work that relies on Javascript?
It won't be functional.
A good practice suggests designing a site not to rely on JavaScript for major functionality. At least, accessing its content (in read-mode) should be possible. JavaScipt should only add interface enhancements like Ajax techniques etc. But the fallback version should always work.
I feel really sad when I see a site which is completely broken without JavaScript. Why can't people use CSS to put elements in proper places? Why do they try to align elements with JavaScript even if there is no dynamics involved?
The same goes for Flash sites. Once in a while a land upon a "web-design-agency" site which makes picky comments about me not allowing JavaScript. When I do I only see a basic primitive site with a few menus and that's it. What was the point of using Flash when the work is so primitive it can be done with raw HTML and CSS in an hour? For me it's a sign of unprofessional work.
All what's done in JavaScript won't work. Some users disable it for security reasons, NoScript is an excellent example. You can try it yourself by removing the scripts from your page or installing the NoScript-plugin for Firefox.
As a rule of thumb:
Make the website working with only semantic HTML
add the CSS
add the JS
But the website should be (almost) fully functional in stage 1.
If you disable Javascript in Safari things like Lexulous in Facebook won't work properly, the mouse letter carry function doesn't work.

Categories