2008-12-30 106 views
7

看這情形:我可以使用<img>標記通過域發送Cookie嗎?

  1. www.websitea.com顯示的img標籤與www.websiteb.com/image.aspx?id=5一個src屬性和style="display:none"
  2. www.websiteb.com返回一個清晰的圖像,除了與referrer名稱和5值(一個cookie從驗證的查詢字符串創建服務器端。)

將cookie創建在域www.websitea.comwww.websiteb.com

目前我確定了一系列具有querystrings的重定向並實現了跨域cookie,但是我在前面提出了這個圖像創意。我想我也可以使用iframe

謝謝!

回答

6

退房: cross-domain-user-tracking

有人提到使用1x1圖像的跨網域追蹤。

+0

我標記了這個答案,因爲它最終解決了我的ie6問題 – Shawn 2008-12-30 22:23:09

6

該cookie將爲websiteb.com創建。

1

的cookie被從請求創建websiteb.com這樣啊...餅乾去websiteb範圍

0

好看起來不錯。在所有瀏覽器中測試過。爲IE6添加了一個P3P標籤,但不知道它是否有必要。

<%@ Page Language="VB" %> 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 

<script runat="server"> 
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) 
     Response.AddHeader("P3P", "CP=""CAO PSA OUR""") 
     Dim passedlocalizeID As String = Request.QueryString("id") 
     Dim localizeID As Integer 
     If passedlocalizeID IsNot Nothing AndAlso Int32.TryParse(passedlocalizeID, localizeID) Then 
      Dim localizer As New Localizer 
      localizer.LocalizeTo(localizeID) 
     End If 
    End Sub 
</script> 

<html xmlns="http://www.w3.org/1999/xhtml"> 
<head runat="server"> 
    <title>Redirecting . . .</title> 
    <meta http-equiv="refresh" content="0;URL=/" /> 
</head> 
<body> 
    <form id="form1" runat="server"> 
    <div> 
    </div> 
    </form> 
</body> 
</html> 
相關問題