Web Development with JavaScript and Ajax Illuminated by Xiang Fu & Lixin Tao & Kai Qian & Richard Allen
Author:Xiang Fu & Lixin Tao & Kai Qian & Richard Allen [Xiang Fu]
Language: eng
Format: epub
Tags: JavaScript, Web Development
Publisher: Jones & Bartlett Learning
Published: 2010-10-21T21:00:00+00:00
5.3 Hidden IFrame
Long before there was widespread browser support for, or use of, an XML-HttpRequest object, developers were using hidden frames to make requests to the server without reloading the page that the user is viewing. The <frame> and <iframe> tags became an official part of the HTML specification with version 4.0 in April 1998. A frame is essentially a window that is embedded in the browser's main window. Frames are independent of the main window in that they can load their own complete HTML page without affecting the content loaded in the rest of the browser. You can hide a frame by using CSS and use JavaScript to dynamically load content into the hidden frame without the user's knowing. A <frame> tag must be declared inside a <frameset>, which replaces the <html> tags. A <frameset> does not display any content itself; its nested frames do. In contrast, an <iframe> can be placed anywhere between the <body> tags, and so it becomes embedded in the content of the HTML page. The <iframe> tag has become more popular than the <frame> tag partially because when the code uses a <frameset> the browser's location bar points to the URL of the <frameset> instead of the URL of the content actually being viewed by the user, which prevents the user from bookmarking the page.
A limitation of the XMLHttpRequest object is that you cannot use it to upload a file. Web developers typically handle file upload by using the tag <input type=“file”/>. The browser renders an input field and a button for this tag that, when selected, displays the operating system's file selection dialog for the user to select the file to be uploaded. After the user has selected a file, all you have to do is submit the form and the browser handles sending the data to the web server for you. Unfortunately, for security reasons, browsers do not allow you to access the file system from JavaScript, and XMLHttpRequest does not have a feature to do this for you. So the only alternative is to use a hidden frame.
Listing 5.2.7
Using setTimeout() and abort() to Time Out a Request
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Sass and Compass in Action by Wynn Netherland Nathan Weizenbaum Chris Eppstein Brandon Mathis(7688)
Grails in Action by Glen Smith Peter Ledbrook(7607)
Configuring Windows Server Hybrid Advanced Services Exam Ref AZ-801 by Chris Gill(6124)
Azure Containers Explained by Wesley Haakman & Richard Hooper(6093)
Running Windows Containers on AWS by Marcio Morales(5597)
Kotlin in Action by Dmitry Jemerov(4956)
Microsoft 365 Identity and Services Exam Guide MS-100 by Aaron Guilmette(4654)
Management Strategies for the Cloud Revolution: How Cloud Computing Is Transforming Business and Why You Can't Afford to Be Left Behind by Charles Babcock(4346)
Combating Crime on the Dark Web by Nearchos Nearchou(4239)
The Ruby Workshop by Akshat Paul Peter Philips Dániel Szabó and Cheyne Wallace(3895)
Microsoft Cybersecurity Architect Exam Ref SC-100 by Dwayne Natwick(3874)
The Age of Surveillance Capitalism by Shoshana Zuboff(3851)
Python for Security and Networking - Third Edition by José Manuel Ortega(3468)
Learn Windows PowerShell in a Month of Lunches by Don Jones(3442)
Mastering Python for Networking and Security by José Manuel Ortega(3266)
Mastering Azure Security by Mustafa Toroman and Tom Janetscheck(3257)
Blockchain Basics by Daniel Drescher(3217)
The Ultimate Docker Container Book by Schenker Gabriel N.;(3138)
TCP IP by Todd Lammle(2910)
