比较全的HEAD头信息介绍
地址 :https://github.com/joshbuchea/HEAD?utm_source=html5weekly&utm_medium=email
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
/**
* 判断是否微信浏览器
* @returns {boolean}
*/
function
isWeixinBrowser() {
var
ua = navigator.userAgent.toLowerCase();
return
(/micromessenger/.test(ua)) ?
true
:
false
;
}
/**
* 微信禁止分享按钮
*
*/
function
forbidShare() {
if
(isWeixinBrowser()) {
function
onBridgeReady() {
WeixinJSBridge.call(
'hideOptionMenu'
);
WeixinJsBridge.invoke(
'disabledShare'
, {},
function
(e) {
return
false
;
});
WeixinJSBridge.invoke(
'closeWindow'
, {},
function
(res) {
alert(res.err_msg);
});
}
if
(
typeof
WeixinJSBridge ==
"undefined"
) {
if
(document.addEventListener) {
document.addEventListener(
'WeixinJSBridgeReady'
, onBridgeReady,
false
);
}
else
if
(document.attachEvent) {
document.attachEvent(
'WeixinJSBridgeReady'
, onBridgeReady);
document.attachEvent(
'onWeixinJSBridgeReady'
, onBridgeReady);
}
}
else
{
onBridgeReady();
}
}
}
//调用禁止分享的方法
forbidShare();
|
Android 分享必须注意
分享小图片必须为 100*100 一下png图片。必须10k一下。- 20160728
<
div
class
=
"sharkelayer"
>
<
div
class
=
"sharebox"
>
<
div
class
=
"line1"
>
<
a
class
=
"clickwx"
style
=
"margin-right:25px"
id
=
""
href
=
"javascript:;"
>
<
img
src
=
"http://dj.58cdn.com.cn/fe/jz/m/orderfor3/lanrenjie/img/sharke-weixin.png"
alt
=
""
width
=
"56"
>
<
div
style
=
"color:#333"
>微信
div
>
a
>
<
a
class
=
"clickpyq"
href
=
"javascript:;"
>
<
img
src
=
"http://dj.58cdn.com.cn/fe/jz/m/orderfor3/lanrenjie/img/sharke-pyq.png"
alt
=
""
width
=
"56"
>
<
div
style
=
"color:#333"
>朋友圈
div
>
a
>
div
>
<
div
class
=
"line2"
>
<
a
href
=
"javascript:;"
class
=
"btn_cancel"
>取消
a
>
div
>
div
>
div
>
|
/* app分享弹层 */
.sharkelayer, .sharkelayer_link {
display
:
none
;
position
:
fixed
;
width
:
100%
;
height
:
100%
;
top
:
0
;
bottom
:
0
;
left
:
0
;
z-index
:
101
;
padding
:
0
;
background
: rgba(
0
,
0
,
0
,
0.8
);
text-align
:
center
;
font-size
:
15px
;
}
.sharebox {
position
:
absolute
;
left
:
0
;
bottom
:
0
;
width
:
100%
;
}
.line
1
{
padding
:
20px
0
;
background-color
:
#fff
;
}
.line
1
a {
display
: inline-
block
;
}
.line
1
img {
margin
:
0
10px
;
width
:
56px
;
}
.line
2
{
background-color
:
#fff
;
}
.line
2
a {
display
:
block
;
height
:
40px
;
line-height
:
40px
;
background-color
:
#e6ecf5
;
color
:
#000
;
}
|
// 分享遮罩
$(
".sharkelayer .btn_cancel"
).click(
function
(e) {
$(
".sharkelayer .sharebox"
).show();
$(
".sharkelayer"
).hide();
e.stopPropagation();
});
//
$(
'.clickwx'
).on(
'click'
,
function
() {
appShare(3);
});
$(
'.clickpyq'
).on(
'click'
,
function
() {
appShare(4);
});
function
showShare() {
$(
".sharkelayer .sharebox"
).hide();
$(
".sharkelayer"
).show();
$(
".sharkelayer .sharebox"
).show();
}
// 分享相关
function
appShare(type) {
var
img = encodeURIComponent(
"http://dj.58cdn.com.cn/fe/other/xxc20160627tvc/images/tvc200_9k.png"
);
var
activityid =
"0"
;
//
var
title =
"58到家发了一个会变大的礼包!"
;
var
direction = type;
// 1.微博2.qq3.微信好友4.朋友圈
var
desc =
"晓明和baby的品质之选,一点即可享受!"
;
var
url =
''
;
var
encodePhone = getCookie(
"tvc_mobile"
);
//getCookie('tvc_mobile');//getCookie(mobile)
if
($(
'.help_me'
).css(
'display'
) ==
'block'
) {
title =
"考验友谊的时刻到了……"
;
desc =
"58到家赠大大大礼,越点越大!"
;
url =
'http://t.jzt.58.com/wechattvc/share_after.html?userPhone='
+ encodePhone;
}
else
{
}
var
share_weixin_url =
"daojia://share?url="
+ encodeURIComponent(url) +
"&img="
+ img +
"&title="
+ title +
"&activityid="
+ activityid +
"&direction="
+ direction +
"&desc="
+ desc +
"&cityid=1"
;
window.location.href = share_weixin_url;
}
// /*导航栏app端分享*/
var
friends = {
'name'
:
'朋友圈'
,
'type'
: 4,
'title'
:
'58到家发了一个会变大的礼包!'
,
'desc'
:
'晓明和baby的品质之选,一点即可享受!'
,
'thumbnail'
:
'http://dj.58cdn.com.cn/fe/other/xxc20160627tvc/images/tvc200_9k.png'
,
'url'
:
'http://t.jzt.58.com/wechattvc/wechat.html'
};
var
wx = {
'name'
:
'微信'
,
'type'
: 3,
'title'
:
'58到家发了一个会变大的礼包!'
,
'desc'
:
'晓明和baby的品质之选,一点即可享受!'
,
'thumbnail'
:
'http://dj.58cdn.com.cn/fe/other/xxc20160627tvc/images/tvc200_9k.png'
,
'url'
:
'http://t.jzt.58.com/wechattvc/wechat.html'
};
var
activity = {
'key'
:
'test'
,
'activity_id'
:
'test_id'
};
var
obj = {
'share'
: [friends, wx],
'activity'
: activity
};
var
str = Base64.encode(JSON.stringify(obj));
function
titleForRightButton() {
var
u = navigator.userAgent;
var
isAndroid = u.indexOf(
'Android'
) > -1 || u.indexOf(
'Adr'
) > -1;
//android终端
var
isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
//ios终端
//业务逻辑
if
(isIOS) {
return
'分享'
;
}
else
if
(isAndroid) {
window.daojia.rightButtonTitle(
'分享'
);
}
}
function
rightButtonClicked() {
$(
".sharkelayer .sharebox"
).hide();
$(
".sharkelayer"
).hide();
var
encodePhone = getCookie(
"tvc_mobile"
);
if
($(
'.help_me'
).css(
'display'
) ==
'block'
&& isLogin() ) {
friends.title =
"考验友谊的时刻到了……"
;
friends.desc =
"58到家赠大大大礼,越点越大!"
;
friends.url =
'http://t.jzt.58.com/wechattvc/share_after.html?userPhone='
+ encodePhone;
wx.title =
"考验友谊的时刻到了……"
;
wx.desc =
"58到家赠大大大礼,越点越大!"
;
wx.url =
'http://t.jzt.58.com/wechattvc/share_after.html?userPhone='
+ encodePhone;
}
else
{
friends.title =
"58到家发了一个会变大的礼包"
;
friends.desc =
"晓明和baby的品质之选,一点即可享受!"
;
friends.url =
'http://t.jzt.58.com/wechattvc/wechat.html'
;
wx.title =
"58到家发了一个会变大的礼包"
;
wx.desc =
"晓明和baby的品质之选,一点即可享受!"
;
wx.url =
'http://t.jzt.58.com/wechattvc/wechat.html'
;
}
var
str = Base64.encode(JSON.stringify(obj));
window.location.href =
'daojia://share/toolbar?'
+ str;
}
|
var
userAgent = navigator.userAgent;
var
cookiestr = document.cookie;
if
(userAgent.indexOf(
'cdvsupport'
) >= 0 || cookiestr.indexOf(
'cdvsupport'
) >= 0) {
document.write(
"
你可能感兴趣的:(javascript学习,html5&css3学习,前端,web前端)
|