1. 可用於將PC版頁面指向移動版頁面,將移動版頁面指向PC版頁面,這樣有利於搜索引擎,對不同設備的用戶提供不同類型的頁面
PC版本頁面head應添加
<link rel="alternate" media="only screen and (max-width:640px)" href="http://m.mobile.com" >
移動版頁面應添加
<link rel="canonical" href="http://wwww.pc.com" >
2. 用於不同css樣式表之間切換控制效果
<link href="default.css" rel="stylesheet" type="text/css" title="默認"> <link href="red.css" rel="alternate stylesheet" type="text/css" title="紅色"> <link href="green.css" rel="alternate stylesheet" type="text/css" title="綠色">
rel=alternate的頁面是默認不會渲染的,可以作為后備樣式,對link使用disabled即可進行切換,無延遲。
但是,提前下載,會浪費單寬,可以在必要的場景下使用。