I'm trying to come up with a script and I'm having a heck of a time...
I require users to enter the size (in MB or KB) of the attachment they
wish to transfer/upload. As they enter the number and move over to
the next field (using onBlur or...), I would like a popup/alert window
warning them that this attachment size would take "x" amount of time
based on a speed of 24 kilobits per second (kbps). If they are happy
with the amount of time, I wish to allow them to click OK (to carry on
with the transfer) or Cancel/No to cancel it.
What I'm doing is taking the parts of my web site that apear on every page, for example the tags from the first <html> tag to the <body> tag, and I just put some JS code into an external file that tells it to write that same code to the browser, then I call the external file where I had the original code.
That way the external file gets cached and they don't have to re-download that part of the code every time.
Combining this, with some other things including gzip I've been able to get my main index page down to 300 bytes, not including images, css files or js files, which are only downloaded once because of caching anyways(and they aren't that big in size themselves, either).
Of course this wouldn't work if you don't want to alienate people who don't use javascript, but 9/10 people do so for some this might be helpful...
Also, this still works with dynamic content as well. for example what I did for my main page where I display the news in little "news boxes" as I call them which are basicly divs setup so they look nice visually... what I did was make a function in the external JS file that accepts the different parts of the news box such as subject, body, time/date of post and who posted it, and then it creates the HTML for it. Then it's really easy to change the look of the displayed news by just changing the js file.
I am working on an ajax application to upload and download encrypted files (AES, 128 bit). The encryption has to be on the client side before sending it to the server.
1. Upload The secret key is stored in a javascript variable during the session. To upload a file, javascript code will show a prompt file dialog and the user will select the file. On hitting submit button a javascript code will call a method in a java applet (with secret key and filename as parameters) that will read the file, encrypt it and sent to the server. I am still coding this but seems to me there will be no problem, the applet even doesn't need to be signed.
2. Download This is where I have the problem.I want the user to click the link, the file should be downloaded, decrypted and opened or 'saved as..'. Is this possible to do in a way that the user doesn't have to do intermediate steps, like 1. Download, 2. Decrypt. 3 Open by the corresponding application ? Right now the idea is to use XMLHttpRequest to download the file into a javascript variable and pass it to the applet, the applet will decrypt and save the file into a temporal directory on the user's computer. After that javascript will present a link that the user will click to open the file. But that are 2 steps and I have to sign the applet to be able to write files. Is there a way to do this as a single process (with an unsigned applet) and at the end to show the 'Save as...' dialog so the user will decide wether to save it or to open with some application?
I implemented Malsups jquery form and use it for ajax file uploads. Works fine in FF, but in IE as soon as the ajax has completed the upload IE gives me a File Download box - Security warning. If I click on save it save thereturnedJson object (I do JS call onsuccessto get a file list and display it). If I click cancel or save on the popup has same effect the file still gets uploaded but just looks ugly.
How can I get rid of this? All coming form the same domain, calling from the same domain. This is on a python django project and I am testing it on the dev server.
Its pretty basic jquery nothing to exciting, don't get why IE would cause.
I do not know much about javascript, so please excuse me if my question is not clear:
If I build a string in Javascript string = "http://test_server_a.some_domain.org"+download_trial_of_product.exe Then use document.location.href=string
It works in Firefox, the popup box says,. would you like to download this file... and the download is what its supposed to be. However, it does not work well in IE. All I get is a nasty pop-up box talking about downloading an Object. What am I doing wrong?
Is it possible, using client-side JavaScript, to test a series of download sites to see which is most likely to be the fastest file download site for a user?
I wondered whether JavaScript could download a portion of a file, or alternatively a small sample image file, just to test the download speed of each site, then report to the user the fastest, next fastest, and so on.
I am trying to create a way for my users to download some code dynamically from my web page via a file download. Below is the code that i have written so far. It seems to be dying on the iframe but i'm not sure why.
Here is my jquery trigger which is inside my onreadystate function.
I need to have a submit input button automatically start a download when clicked, but also redirect to an additional "information" page. Since I'm not sure if this can simply be solved with HTML or must use some Javascript.
I have used ASP.net 1.1. In that application user can upload the file(any printable document like doc/xls/ppt/pps/jpg/gif etc.,). The user allows to upload a max of 4MB.
But if the user uploads more than 4MB I'll issue a msg. But in slow network, the user needs to wait for much time to upload and even get error msg.
I want to stop from client side itself. Once the user selects the file to upload it shud b checked frm Javascript.
* Is there any way to do achieve this? * The user should not change security settings in browser, if u suggests some method. * If it is not possible/meaningful then please tell me the reasons very clearly. So I can stop searching. * Please note any printable document can be uploaded.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
Is it just extraneous code possibly? It seems to be ok (from right to left) in Firefox 3 but using IE and Opera, it scrolls from btm to top and I cannot figure out why.
Is there a way where I can "guess" what relative speed the user's connection is?
Currently, the client is wanting some graphical intensive content and I'd like to be able to warn users on dial-up to allow them to go to a "gracefully degraded" version.
I thought of simply putting up a question for users to answer but the client would rather it happen, more or less, automatically.
I found this on JavaScriptKit. It checks to see if the site accessing the data is your domain. I found it pretty cool.
//Beginning of "test.js" file var accepted_domains=new Array("wsabstract.com","javascriptkit.com")
var domaincheck=document.location.href //retrieve the current URL of user browser var accepted_ok=false //set acess to false by default
if (domaincheck.indexOf("http")!=-1){ //if this is a http request for (r=0;r<accepted_domains.length;r++){ if (domaincheck.indexOf(accepted_domains[r])!=-1){ //if a match is found accepted_ok=true //set access to true, and break out of loop break } } } else accepted_ok=true
if (!accepted_ok){ alert("You're not allowed to directly link to this .js file on our server!") history.back(-1) }
i want to do (multiple) file upload(s) and display a progress bar. with firefox and safari it is no problem at all. only IE makes some problems.
my script is based on ajax-uploader, which can be found at www.srmiles.com/freestuff/ajax_file_uploader/ . you can do multiple file uploads. each upload will have it's own "form"-tag, so that each file is uploaded for its own. could be a good solution if there are "big" uploads.
so here is what i do:
i have a html-page in which several forms with file-input fields are generated. when i now hit the "one" submit button at the bottom of the page a javascript function upload() starts it will iterate through all forms (id='frmUpload_xx'), will get the filename, start a ajax request for the progress-bar function and do a form.submit().
if the first form/file is uploaded, a settimeout('upload()', 1000); is called and the next form will be processed. all form's have an target="uploaddiv", where uploaddiv is a invisible iframe. so the output of the upload script is put in this div. output should only be a "OK" at the end. no usefull output no info no nothing.
firefox and safari are working as expected, only IE stops after the first file is uploaded. i get an javascript error saying "zugriff verweigert/access denied" on object line x... this is the place where i call "form.submit()".
this is the upload-function:
function upload() { if (uploads.length>0) { form = document.getElementById('frmUpload_'+uploads[0]); if (form["filename"].value == ""){ alert("Please Choose a file to upload."); } else { filename = form["filename"].value; if (filename.lastIndexOf("")>0) { filename = filename.substring(filename.lastIndexOf("") +1,filename.length); } else if (filename.lastIndexOf("/")>0) { filename = filename.substring(filename.lastIndexOf("/") +1,filename.length); } makeRequest("upload_progress.php?sid="+sid +"&filename="+filename,progress); form.submit(); } } }
the strange thing is, that filename is filled correct, that means the object "form" is found and exisits. the first iteration is working, only the second ends with an error.
think it have something to do with redirecting the output of the upload-script in an iframe. after that IE can't access form - at least IE is not allowed to submit the form as i can access a form field (filename). i worked on that the last two days and haven't found a solution...
I have a page /download.php.basically on entry this page displays a browser download dialog box for a file.I was wondering if there is a way to use .load() to get the same download dialog box on another page.I tried the code below but it does not work/ what jquery function I can use to get this working
I am trying to get started using JQuery, but I find I can't even get to lesson #1. When I go to jquery.com and click to download the latest version (or any version) it doesn't "download" anything. It opens the file as a webpage in my browser and I see all the JQuery in one big string. Why won't the file just download? Is it the browser I am using? Is it my Mac?
I am looking for a upload form to upload pictures and then when the pictures are uploaded, then they get emailed to me. Kind of like a contact form but attached is the pictures.
Does anybody have a Download Dialog written in JavaScripts? This is for a website. I've seen it done before.... where you click on what you want and the dialog comes up asking you if you want to save it. From what I can tell, the name of the file is passed as a parameter of the JavaScript.
I'm using ASP.NET and setting window.location.href in my web page to output an audio file that the user is prompted to download. I would like to provide a link so that the user can download the audio file and an XML file one after the other. I've been experimenting with opening a new window, but there must be a cleaner way of doing this.
I tried redirecting in the onLoad event of the form but doesn't work. I suppose it redirects as soon as the activeX is loaded and not when it has finished its download.