Web design and hosting, database, cloud and social media solutions that deliver business results
  • ビジネスソリューション
    • データベースサービス
      • サーバーのアップグレードと DBA サービス
      • データウェアハウス サービス
      • データ統合
      • パワーBI
    • ウェブサイトデザイン
      • Web サイトのセキュリティ
      • Web サイトの最適化
      • ロゴデザイン
      • 支払いゲートウェイ
      • テクニカルツール
    • ビジネスサービス
      • Google クラウド サービス
      • アマゾン ウェブ サービス
      • マイクロソフト アズール
    • ソーシャルメディア
    • マイクロソフトオフィス
  • 学校
    • テスト環境
    • 学習データベース
      • 基礎
      • SQL Serverデータ
      • SQLServerのメンテナンス
      • SQL Serverの日付の使用
      • SQLServerピボットの使用-ピボット解除
      • SQLServer関数の使用
      • オープンクエリを取得
      • ツール
    • ウェブデザインを学ぶ
      • Ousia コンテンツ管理システムの構築
      • ASP-NET の使用
      • CSS の使用
      • JavaScript の使用
    • クラウドと IT サービスの学習
      • タスク スケジューラ エラー 2147943645
      • OpenSSL での SSL の要求と PFX ファイルの生成の簡単な手順
    • ソーシャル メディアの使用
      • Facebookアカウントを個人用からビジネス用に変更する
      • Google レビューを依頼する
      • ソーシャル メディアの取り組みをどこに集中させるかを選択する
      • ソーシャル メディアの画像サイズ
      • メタ データを使用してソーシャル メディア画像を設定する
  • 私たちに関しては
    • ブログ
      • Google コア アップデート 2020 年 1 月
      • インターネット上のウェブサイトに関する最も厄介なこと
      • ウェブサイトの広告リーフレットのコンテンツを選択する方法
      • エントリーレベルのゲーム機の構築
      • オンライン詐欺の防止
      • ギグエコノミーのスキマー
      • ホットチリインターネット閉鎖
      • 無料のベクター グラフィックスのトップ 5 Web サイト
    • キャリア
      • 翻訳者 英日
      • 英語-トルコ語翻訳者
    • チーム
      • アイセ・ハー
      • アリ アル アミン
      • ギャビン・クレイトン
      • サイガングー
      • スーリヤ・ムッカマラ
      • スニール・クマール
      • チェスターコッパーポット
    • ポートフォリオ
English (EN-GB)Español (ES)हिंदी (HI)italiano (IT)日本語 (JA)Português (PT)

HTML を最小化するにはどうすればよいですか?

各リクエストのサイズを最小限に抑えることで、費用を節約し、Web サイトの速度を上げて、検索エンジンとユーザーの両方を満足させることができます。

Code bloat

MinimiseHTML.png

Modern web sites are full of unnecessary or bloated code, however these can have a huge impact on the speed of your website.

We have some separate articles for minimising CSS and JavaScript but what about HTML?

If you develop in Visual Studio, content automatically gets tabbed to increase readability, but each of those tabs is a character that needs to be zipped and sent by your server then received, unzipped and parsed by the browser.

One of the simplest wins is to use shift+tab to left align all of the code. The difference between the two sets of code from a section of a web site in the image is 2212 characters for left aligned and 2455 for the standard code.

It doesn't sound like a lot, but if it is done across your whole site you could save thousands of bytes, and potentially also money as you will have less bandwidth being used.

Remove unnecessary formatting

Below is an extract from one of our other articles.

When I first started writing my blogs, I would copy and paste from the relevant application into MS Word, and then into the article so that I could keep the colours. While it looks nicer, it is a serious code bloat.

The copy on the left (or first on mobile) is unformatted text, and weighs in at 1474 characters. The second is formatted with only the colours and comes in at 6869 characters.

The difference in reading them is minimal, and our end user can still copy and paste into their own applications if needed.

On a mobile device this is a big saving.

Unformatted

Use [utilities]GOCREATE PROC [maint].MaintenancePlan AS BEGINDECLARE @BackupType VARCHAR(1)='E'IF DATEPART(HOUR,GETDATE()) BETWEEN 5 AND 21 BEGINSET @BackupType='D'END--EXEC ('USE TempDb; DBCC SHRINKFILE(templog, 0)');--This is only needed when space is at a premium!--Re-index LiveIF @BackupType='E' EXEC [maint].DatabaseReIndex 'dbname'--Create BackupBACKUP DATABASE TO DISK=N'{backuplocation}{dbname}.bak'WITH NOFORMAT, INIT, NAME =N'{dbname}', SKIP, NOREWIND, NOUNLOAD, STATS= 10;--EXEC ('USE ; DBCC SHRINKFILE(_log, 0)');--This is only needed when space is at a premium!--Backup Other Files at NightIF @BackupType='E' BEGIN  EXEC [maint].DatabaseReIndex 'dbname'  --Backup Others  BACKUP DATABASE [databasename] TO DISK=N'{backuplocation}{dbname2}.bak'  WITH FORMAT,INIT, NAME =N'{dbname2}',SKIP, NOREWIND, NOUNLOAD,  STATS= 10END
--Restore Backups on other serverEXEC [server].[utilities].[maint].KillConnections 'dbname';EXEC [server].[utilities].[maint].RestoreDatabase_{dbname};
--Restore Backups on other server for db_2 etcIF @BackupType='E' BEGIN  EXEC [server].[utilities].[maint].KillConnections 'dbname2';  EXEC [server].[utilities].[maint].RestoreDatabase_{dbname2};END
ENDGO

Formatted

Use [utilities]
GO
CREATE PROC [maint].MaintenancePlan AS BEGIN
DECLARE @BackupType VARCHAR(1)='E'
IF DATEPART(HOUR,GETDATE()) BETWEEN 5 AND 21 BEGIN
SET @BackupType='D'
END
--EXEC ('USE TempDb; DBCC SHRINKFILE(templog, 0)');--This is only needed when space is at a premium!
--Re-index Live
IF @BackupType='E' EXEC [maint].DatabaseReIndex 'dbname'
--Create Backup
BACKUP DATABASE TO DISK=N'{backuplocation}{dbname}.bak'
WITH NOFORMAT, INIT, NAME =N'{dbname}', SKIP, NOREWIND, NOUNLOAD, STATS= 10;
--EXEC ('USE ; DBCC SHRINKFILE(_log, 0)');--This is only needed when space is at a premium!
--Backup Other Files at Night
IF @BackupType='E' BEGIN
  EXEC [maint].DatabaseReIndex 'dbname'
  --Backup Others
  BACKUP DATABASE [databasename] TO DISK=N'{backuplocation}{dbname2}.bak'
  WITH FORMAT,INIT, NAME =N'{dbname2}',SKIP, NOREWIND, NOUNLOAD,  STATS= 10
END

--Restore Backups on other server
EXEC [server].[utilities].[maint].KillConnections 'dbname';
EXEC [server].[utilities].[maint].RestoreDatabase_{dbname};

--Restore Backups on other server for db_2 etc
IF @BackupType='E' BEGIN
  EXEC [server].[utilities].[maint].KillConnections 'dbname2';
  EXEC [server].[utilities].[maint].RestoreDatabase_{dbname2};
END

END
GO

Minify CSS

Our tool to minify your CSS files
Optimise your CSS for a faster web site

Minify JavaScript

Our tool to minify JavaScript
Optimise JavaScript for a faster web site

What else can be done?

Removing the line returns will give you an even bigger saving, but can be time consuming.

There are plugins for various applications, so it may be worth having a look in your favourite search engine.

Author

Copyright Claytabase Ltd 2020

Registered in England and Wales 08985867

RSSLoginLink クッキーポリシーサイトマップ

Social Media

facebook.com/Claytabaseinstagram.com/claytabase/twitter.com/Claytabaselinkedin.com/company/claytabase-ltd

Get in Touch

+442392064871info@claytabase.comClaytabase Ltd, Unit 3d, Rink Road Industrial Estate, PO33 2LT, United Kingdom
The settings on this site are set to allow all cookies. These can be changed on our Cookie Policy & Settings page.
By continuing to use this site you agree to the use of cookies.
Ousia Logo
Logout
Ousia CMS Loader