WEB DESIGN GARAGE [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

WEB DESIGN GARAGE [Electronic resources] - نسخه متنی

Marc Campbell

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید








BLOG: Embedding or Attaching?



You have two methods: embedding and attaching. Which is better?


The answer is, attaching. By far.


I like attaching scripts and style sheets. It allows me to use the same script file or style sheet on as many Web pages as I want, which is invaluable for frequently used functions like rollovers or popup menus and sitewide styles. If I tried to embed these things, I'd have to copy and paste the same blocks of code over and over again onto each and every page that requires them. This seems to me like a waste of time, not to mention bandwidth. The visitor's browser has to load the embedded stuff again and again, while the browser caches attached files.


Even more importantly, if I want to change something late in the process, I only have to fix it once, in the attached script or style sheet. When you embed everything, you have to go through every instance of the code and make the same corrections over and over again. Another needless waste of time.


Besides, for those who strive for per-spec implementation, the W3C recommends that you attach rather than embed.


Bottom line: Embedding is fine for quick, one-shot functions and styles. For anything you might want to reuse, attaching is the only way to fly.



/ 175