Discussion Locked

Web Development Forum (continued)

0 helpful
25 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Welcome to the Web Development Forum. This is the place to post your Web development questions, share your best techniques, and express your opinion on topics that impact IT development. We also encourage you to post your comments about the Web Development Zone TechMail.

If you aren't already subscribed to the Web Development Zone TechMail, you can use the following link to automatically subscribe to the free weekly e-newsletter:
http://nl.com.com/MiniFormHandler?brand=builder&subs_channel=bldr_front_door&list_id=e055&tag=fb

Also, don't miss the discussion from the previous Web Development Forum. Use the link below to catch up on earlier member comments.
http://builder.com.com/5208-6230-0.html?forumID=26&threadID=118966&messageID=715968

* Please delete any extra spaces that appear when you paste links into your browser.

25 replies

by maryweilage

The Sept. 2 edition of the Web Development Zone e-newsletter explains and demonstrates how you can use the XMLHttpRequest object in Mozilla-based browsers. If you're interested in learning more about several of the topics mentioned in the newsletter, please visit the following links.

For more information about XBL:
http://www.mozilla.org/projects/xbl/xbl.html

For more information about using XML data islands in Mozilla:
http://www.mozilla.org/xmlextras/xmldataislands

by vkelman

Hello!

I'm trying to write [JavaScript] code to upload [binary] files from user's machine to a server (PHP page) using XmlHttpRequest object.

The very first question is how to attach a file to XmlHttpRequest? As I understand I need to create something called a "stream" to do it. Is it possible to do it in Mozilla and IE using JavaScript and possible XML?

--
Vladimir Kelman
www.vkelman.com
vlad@vkelman.com

by vkelman

More precise: I was going to use such a technique in my photo gallery to allow authors to upload their pictures. I don't want to limit their browsers to IE only and their OS to W2K. I'm successfully using XmLHttpRequest object on both IE and Mozilla to post data without page reloading, but it looks like it is not possible to use it for file uploading and I hav eto revert to IFRAME technique....

by ak_from_ak

"John McCormick is a security consultant and well-known author in the field of IT, with over **15,500** published articles."

Hehehe, must be a busy boy, that works out to something like an article every day for over 42 years.... When does he have time for consulting???? :)

by maryweilage

This week's Web Development Zone e-newsletter discusses how to manage layouts with custom elements. How do you maintain consistent layouts from page to page? Do you think you'll use the method described in the column to do so in the future? Please share your thoughts on this subject.

by maryweilage

The Oct. 21 and Oct. 28 Web Development Zone e-newsletter describes how to create a Wireless Markup Language (WML) phone directory. What are your experiences with WML? Do you think you'll create a WML phone directory using the example in this e-newsletter?

by chuckr314159

I have a couple questions related to Philip Perkins 7/16 Web Development Zone article.

We've been looking for an easy way to allow file uploads to our server. We can handle the login/permissions okay, but if we used this method...

(1) With respect to the two objects declared in the javascript (ADODB.Stream and MSXML2.XMLHTTP)...Do we need to worry about something being installed on the client machine for this to work, or do these typically exist as part of all mainstream browsers, OS's, or something else?

(2) We've tried some other freeware routines that we've downloaded that seem to have a severe file size limitation and I've seen references to inherent size limitations in some methods. Does this method have a similar limitation?

(3) What about virus protection? Is there a way to programmatically invoke a virus scan of a file before it gets uploaded to the server, or are there other precautions we can take?

(4) Can anyone suggest a way to get "progress" info back to the browser so that we can present a "progress bar" or some such visual for large file uploads?

Thanks in advance,
Chuck

by maryweilage

(1) ADODB.Stream is included with Microsoft Data Access Components (MDAC) 2.6 or above. This should be available on machines running Windows 2000 or above and I think it's part of the latest service pack for NT. However, I'm not very sure about anything below Windows 2000. You can get it as a download. The problem is that in order to utilize this component, you must either have "Initialize and script ActiveX controls not marked as safe" set to Prompt or Enable in IE's security. MSXML2.XMLHTTP is only available in XML 2.6 or above. This is a safe object so you can script it in IE without any problems. There is another XMLHTTP object you can script for older versions of XML: Microsoft.XMLHTTP. The later version is available to IE 5.5 SP2 browsers and above. The earlier version is available to IE 5.0 browsers. In order to overcome either situation try this:
var xmlhttp = null;
function window_onload() {
try {
xmlhttp = new ActiveXObject("MSXML2.XMLHTTP");
} catch(e) {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} finally {
alert("This functionality is limited to IE 5.0 and above.");

(2) I tested it on a 91MB file and it failed. I think there is an inherent POST size limitation with IIS, but I'm not sure. I read somewhere that there isn't one, but that doesn't explain why it doesn't work. I can try to find out more if you like.

(3) You can scan the virus once it's been uploaded. As long as there isn't any kind of automatic execution of a file, it should be safe but I'm not promising anything.

(4) I don't know if there is any way to put a progress bar on this, but I haven't tried.

The best advice that I have for you is to develop an internet component, implement the IObjectSafety interface (allows for scripting without prompt or disable), and digitally sign it so it can be installed on the user's system. You would then use either the MS Internet Transfer Control or the MS Winsock control to send the file data to the remote server. That way, you can provide a progress bar as well. If you need more information on this, just let me know: phil_perkins_1@yahoo.com

Phillip Perkins

by maryweilage

In the November 4 and November 11 Web Development Zone e-newsletters, Phillip Perkins explores universal data management and services through raw HTML. Do you agree with Phillip Perkins' statement that the way to truly ensure that all browsers can see your Web site is to provide only raw HTML to the browser? What design concept makes your development easier? What techniques do you use to manage user navigation and produce alternative techniques for saving/transferring data? Share your thoughts in this discussion forum.

by dkhorne

Having been burnt in one development by inconsistent support for CSS, I have come to the conclusion that Keeping It Simple (Stupid) is the key to wide support development.

I recently used this principle to create an online irdering system that went into production with virtually no major issues. So I applaud the approach outlined in this article and look forward to Part 2

by dale.wilbanks

I have an attraction to building sophisticated client side DHTML. On my last project, I danced to close to the fire and got burned. We were using the WebService.htc to grab XML from the server, and then bound to it on the client side. Boy, did we get burned! First, the webservice.htc would lock up the browser anytime a connection failed, which made it very difficult to troubleshoot.

Lesson Learned: Keep It Simple Stupid.
The less code you send to the browser, the more reliable your application is going to be.

Remember, Yahoo! is the longest running big site on the net, and they are always KISS. If Yahoo! doesn't need this fancy stuff, then why does your app?

by blaine moore

Having just read the "Transmit binary data with base64 encoding" newsletter, I have a few questions. I had looked into Base64 encoding a few weeks back, and managed to find plenty of sources for the algorithm, as well as a few proprietary components that can be bought or used online but which don't publish their code.

Something that I notice with the algorithms I found was that special characters have a tendency to break the encoding, such as the "@" symbol used in an email address. Using the online versions they were able to convert it fine, but how does this translate specifically?

The area I was looking into the Base64 encoding was in relation to SMTP.

by swstephe

Base64 takes binary data, broken up into 8-bit bytes, and transmits the data is 6-bit segments encoded as 64 ascii characters. If there is an "@" is the data, it ought to be encoded quite easily, just like any other character. The output will not contain a "@". The only valid characters are letters, (a-z,A-Z), numbers, (0-9), "+" and "/" ... and "=" for filler.

Remember that Base64 encoding is used to encode the body of messages and file uploads, not headers, like e-mail addresses.

by dpatillo

From one of your recent emails:

I bound the tables to XML data islands (to keep from going insane debugging tons of output); this made the code applicable to only IE 5.0+.

What about Netscape, Mozilla, and others?

by phil_perkins_1

I just tried to get this to work in Mozilla 1.2.1 (after heavy changes) and there are too many quirks in Mozilla to get this to work properly. For example, when you finally get to a point where you can capture the onscroll event to sync up the separate DIVs, it doesn't always sync up. So if you're scrolling fast you may be off when you stop scrolling. Also, you cannot set the overflow style property to hidden and set the scrollLeft or scrollTop properties (you have to have the overflow set to scroll). I used this example in an intranet application, so I have complete control over the browser. If you're going to try this in another browser, I suggest you learn Java and create an applet to handle this. It's interesting when things that don't work in MS applications, people call it a bug. When something doesn't work in another application, people call it proprietary. I think this is a bug in Mozilla. :)

by bblackmoor

"this made the code applicable to only IE 5.0+"

Translation: this article was a waste of bandwidth. Adhere to web standards -- if a web development article does not adhre to web standards (i.e., HTML 4.x or XHTML 1.x, CSS-2, and ECMAScript-262) then you should not publish it. It is a waste of everyone's time.

by theburbs

Many of us actually have customers who demand such things as a design for a specific browser. And what browser is that? Certainly not Netscape. Although Navigator has come a long way towards becoming once more a competitive browser, it still has little acceptannce in much of the business world. Nor are Opera or others yet of interest, despite having their own strengths and high points.

I find articles such as this very useful, as they are directly applicable to work in which I am involved. Although I appreciate the fact that cross-browser coding is necesssary for broad-based applications, many of us do have a more focused audience.

by phil_perkins_1

Finally, someone else has stepped forward to admit that they too need to develop for a more focused audience.

As I've stated time and time again, the purpose of my articles is not to force upon anyone a particular technology. It is only to show what exists. I've actually tried to get this example to work in Mozilla (after losing the data binding and re-adjusting the styles), but there are some bugs in Mozilla that won't allow me to do this. I didn't try anything else since Mozilla is IE's only major competitor. Plus, I don't get paid for it. ;)

Thank you for your comment, I do appreciate it.

by bblackmoor

"Many of us actually have customers who demand such things as a design for a specific browser. "

Then you as a professional owe it to those customers to explain why their myopia is self-defeating. They can't be expected to know what solutions they need -- that's why they hire *us*. They only know what they need to *accomplish*.

On the other hand, if you have a client who really is that provincial and myopic, you owe it to *yourself* as a professional to break relations with them and move on. You are not doing your professional development any favors by working for clients mired in mid-1990 thinking. The web does not belong to *any* specific browser, and has not for several years.

Articles like this one ("CREATING CUSTOM ELEMENTS AND BEHAVIORS IN IE5.0+") only demonstrate that some developers are too short-sighted to make the best decisions for themselves and their clients -- and both will suffer for it in the long run. Browser-specific web development is, at best, a quaint reminder of the late 20th century. Other than nostalgia, it has nothing to offer.

by theburbs

I have tried to implement a scrollable grid component using only DHJTML/CSS to various degrees of success. One nagging problem that I have is evident in the code within this column. that is it is difficult to match the headers with the data columns.

I enjoyed reading the article, as I am working with data islands and grids. However, I wish that the result would corect this header/column issue as well. Has anyone else been able to surmount this problem?

by phil_perkins_1

You can create two tables: one with the headers and one with the data. Set the column widths using and set the style of the table to "table-layout:fixed;". This should solve your problem. I did this in my example. Also, make sure that the border widths on your cells and column headers match.

by web dev guy

I have built a page that utilizes xml data bound tables. I have had one big hangup.

My xml island is quite large, and provides the capability to update the individual values via form input fields.

PROBLEM: I only want to submit the nodes that were added/modified back to the server for saving to the database.

DETAILS: Each displayed node has an element called recordstatus that is not displayed for output in my table. When the user makes a change to an element, I want to update the recordstatus element for only that node.

I have no problem manipulating XML via VBScript/JScript, but can't seem to find a way to programatically isolate which node was changed. How are the nodes identified in an xml data bound table?

by gator4life

To update the recordstatus elements for nodes that are changed, add onchange event handlers to the input elements. Set the onchange event handlers to call a JavaScript routine that accesses the XML data island to make the necessary changes. Therefore, when the value of an input element is changed, the JavaScript routine will go ahead and only update the recordstatus element for the data bound to that particular input element. I would suggest adding id attributes to your XML data island elements to make them more easily accessible with the JavaScript routine. Hope this helps.

by bad boys drive audi

I second that opinion. The only, and I mean ONLY reason that I would ever consider coding for a specific browser family is if the site is going to be Intranet specific.

But even then, I cringe because I know that if the company "somehow decides" to change their browser family standard, they lose all the equity built into the application.

by rccprof

Yes, I agree too. It would be one thing if an occasional digression into IE-specific applications was featured here, but it seems to be the rule rather than the exception and that is quite disappointing. Those of us who develop real world applications cannot afford this myopic view of our users and thus find these articles little more than mental masturbation -- ultimately unfulfilling.

This discussion is closed to new replies.