Response.Cache.SetCacheability(HttpCacheability.Private)
Response.Cache.SetExpires(Now.AddYears(1)) '一年後才會到期,沒有這個就不會有 200 (From Cache)
Response.Cache.SetLastModified(Now) '若是 Browser 送出了一個新的 Request, 有可能會回 304
//先檢查是不是已經登入
FB.getLoginStatus(function (response) {
if (response.status === "connected") {
// 已登入FB
}
else {
// 未登入FB
// 盡量不要在此呼叫 FB.login , 因為彈跳視窗會被擋下來
}
});
//呼叫登入 scope:publish_stream 是要讓user同意發文到FB的權限
FB.login(function (response) {
if (response.authResponse) {
// 已登入,可取得 AccessToken
} else {
// 未登入
}
}, { scope: 'publish_stream' });
// 檢查 user 有無同意發文到FB的權限 (publish_stream)
FB.api({ method: 'users.hasAppPermission', ext_perm: 'publish_stream' }, function (resp) {
if (resp === "1") {
//有同意
} else {
//不同意
}
});
// 分享連結到登入者的FB牆
// msg 是發文的內容
// link, picture, caption, description 是一組的
var args = {
message: msg,
link: product.Link,
picture: product.Picture,
caption: product.Name,
description: "超高口碑BB霜/CC霜、頂級精華液哪款半價 由你決定!"
};
FB.api('/me/feed', 'post', args, function (response) {
if (response.id) {
// 成功會回傳訊息id
}
else {
// 分享失敗
}
});
FB.ui({
method: 'feed',
name: '快去搶!超過9成的使用者滿意推薦的《玻尿酸精華》',
link: 'http://www.shopunt.com/tch/event/2014-aqua-deluge/default.aspx',
picture: 'http://www.shopunt.com/Upload/tch/unt/14mar/fb154x154.jpg',
caption: 'UNT 頂級玻尿酸保濕精華液(奢華)',
description: '熱銷破百萬 真實口碑見證的水感奇肌 逆時補水科技 快速滲透 為肌膚注入高水位……'
},
function (response) {
if (response && response.post_id) {
// handle success
}
else {
alert("facebook分享失敗!");
}
}
);
// 例如
Common.popUp({
Title: "....",
Message: "......."
.....
onOKClick: function() {
// handle onclick ok button event
},
onCancelClick: function() {
// handle onclick cancel button event
}
});
//判斷頁面上某物件是否存在的方式~
var str = "Hello Morse";
if (document.getElementById('Create_Menu')){
document.getElementById('Create_Menu').innerHTML = str;
}else{
}
相關文件
http://localhost:2874/WWW20/scripts/Merge/Create_Menu.js
有時候會用html去取代物件裡的內容,但是當取代的文字過長的時候,很可能會沒有錯誤訊息,但是卻又無法正常顯示,尤其是IE8
var str = "過長的文字";
$(".asdasd").html();
此時我們最好使用以下的方式
var str = "過長的文字";
document.getElementById('Create_Menu').innerHTML = str;
就可以正常執行了
相關參考
http://localhost:2874/WWW20/scripts/Merge/Create_Menu.js
Inherits Master
Protected Sub Page_PreLoad(sender As Object, e As EventArgs) Handles Me.PreLoad
End Sub
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
HandleAction()
End Sub
Sub HandleAction()
If UW.WU.IsNonEmptyFromQueryStringOrForm("Action") Then
Dim Action As String = UW.WU.GetValueFromQueryStringOrForm("Action")
Select Case Action
End Select
End If
End Sub
Protected Sub Page_PreRender(sender As Object, e As EventArgs) Handles Me.PreRender
LoadPageContext()
End Sub
Sub LoadPageContext()
End Sub
Sub JSONWriteToClient(ByVal TrueorFalse As Boolean, Optional ByVal msg As String = "", Optional ByVal Title As String = "", Optional ByVal Content As String = "", Optional ByVal Content2 As String = "", Optional ByVal Content3 As String = "")
Dim TF As String = Now.ToString("yyyyMMddHHmmss")
Dim oJ As UW.JSON
oJ = New UW.JSON(TrueorFalse, msg)
oJ.add("Title", Title)
oJ.add("Content", Content)
oJ.add("Content2", Content2)
oJ.add("Content3", Content3)
oJ.add("TF", TF)
oJ.WriteToClient()
Response.End()
End Sub
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!--Header S-->
<!--<title>{Title}</title>
<meta name="description" content="{Description}" />
<script type="text/javascript" src="{UNTJS}"></script>-->
<!--AutoScripts S--><!--AutoScripts E-->
<!--AutoCSS S--><!-- AutoCSS E-->
<!--Header E-->
</head>
<body>
<!--Content S-->
<!--FinalScript S-->
<script type="text/javascript">
$(document).ready(function () {
})
</script>
<!--FinalScript E-->
<!--Content E-->
</body>
</html>