Wednesday, July 01, 2009

<Blogger> 模板标签生成奇怪 Javascript

昨天由于有新的评论,有一篇帖子的页面被重新生成,然后页面就出现了一些奇怪的问题。仔细查看源代码后,发现在生成页面的时候,模板里面所有的 </Blogger> 标签的画面,都被加上了一段奇怪的 JavaScript 代码:
<script type="text/javascript" src="http://www.blogger.com/static/v1/common/js/327583163-csitaillib.js"></script>
<script>if (typeof(window.attachCsiOnload) != 'undefined' && window.attachCsiOnload != null) { window.attachCsiOnload('ext_blogspot'); }</script>

重新发布了几次仍然是这样,因此推测可能是 Blogger 做了更新。在 Google 上搜索了一下,发现很多 Classic Template 的使用者都发现了相同的问题,并且报告在 Blogger 的 Google Groups 帮助讨论组,如这篇帖子,还有这里,以及这里。虽然有很多网友提出了各种临时的解决办法,但看起来都不尽如人意。

个人认为 Blogger 这个新的功能添加得不够专业。先且不论是什么功能,光是直接在</Blogger> 标签后加入 <Script> 就不可取,因为 Blogger 这一对标签里面包括和帖子相关的数据,页面上凡是需要帖子标题、ID、时间等相关信息的地方都会用到这一对标签,它可能出现在标题、正文甚至其它的 JavaScript 中(例如我就需要通过这对标签取得帖子的 ID 并作为参数传给 JavaScript 函数)。

目前暂时通过人工编辑 HTML 去掉了相关的 Script,如果近期 Blogger 不能解决这个问题的话,就只有另外写 PHP 程序来自动处理了。

Update July. 2, 2009:

这篇帖子中一位来自 The Blogger Team 的用户提到,这的确是他们发现的一个 bug,将很快被修复。让我们拭目以待吧……

Update July. 8, 2009:
这位来自 The Blogger Team 的用户提到,他们已经在 Blogger 的 Known Issues 网站上记录了这一问题以便跟踪。从该帖内容来看,他们只认为问题只出在不该在 <title></title> 之间输出 script 内容。难道他们不知道这一对 <Blogger></Blogger> 还可能用在用户自己定义的 JavaScript 中吗?

11 comments:

笨乌不飞 said...

很佩服您的手动能力,拜读了您不少文章,似乎您这个博客就是为了让我们惊讶于“啊 Blogger 居然在天朝还可以访问啊!”而诞生的。

呵呵。

G said...

我看你网页源代码里没有这段奇怪的JavaScript,请问你是怎么去掉相关的 Script?

Kang said...

请问你是用 这样的方法解决的么?你是怎样让博客标题在你文章题目后面的?

Gregory said...

@G, 我是在页面被发布后,用PHP扫描所有的页面,用正则表达式把所有的奇怪 JavaScript 去掉了……

@Kang, 将模板 title 那个地方写成下面这样就可以了:即,Main 和 Archive 页面,直接显示博客名称,Item 页显示成“文章标题 - 博客名称”的形式。

<MainOrArchivePage>
<title><$BlogPageTitle$></title>
</MainOrArchivePage>
<ItemPage>
<Blogger><title><$BlogItemTitle$> - <$BlogTitle$></title></Blogger>
</ItemPage>

oakleyses said...

ferragamo shoes, supra shoes, abercrombie and fitch, ray ban pas cher, wedding dresses, nfl jerseys, reebok outlet, hermes, juicy couture outlet, air max, lululemon, p90x, ghd, timberland, mulberry, lancel, hogan, new balance shoes, birkin bag, mont blanc, asics, nike air max, ugg boots, soccer jerseys, hollister, rolex watches, north face outlet, beats by dre, montre pas cher, nike free, louis vuitton, ugg boots, herve leger, chi flat iron, vans, ralph lauren, oakley pas cher, jimmy choo, insanity, converse shoes, louis vuitton, karen millen, celine handbags, bottega veneta, marc jacobs, soccer shoes, mcm handbags, yoga pants, burberry, valentino shoes

Unknown said...

louis vuitton handbags
burberry scarf
ray ban sunglasses outlet
michael kors
cheap uggs
cheap oakleys
abercrombie fitch
ugg boots
tory burch flats
lv outlet
tods outlet
michael kors handbags
michael kors outlet online
ghd flat iron
coach outlet
coach factory online
prada handbags
lebron 11
canada goose jacket
ray ban outlet
christian louboutin
chanel handbags
coach outlet
polo outlet
michael kors outlet online
ray ban canada
coach factory outlet
20150311huangqihang

Unknown said...

air max 90
bottega veneta outlet
nike air max uk
nike huarache
custom mlb jerseys
surpa sneakers
coach outlet
seattle seahawks jerseys
the north face uk
kansas city chiefs jerseys
nike outlet store
atlanta falcons jersey
chanel handbags
green bay packers jerseys
michael kors uk
los angeles clippers jerseys
burberry outlet
dallas cowboys jersey
nike running shoes
arizona cardinals jerseys
oakley sunglasses canada
the north face outlet
oakley sunglasses
real madrid jersey
cleveland cavaliers jersey
pittsburgh steelers jersey
north face jackets
soccer shoes
mizuno running
san francisco 49ers jerseys
dansko outlet
new orleans saints jerseys
new york jets jerseys
air jordan shoes
los angeles lakers jerseys
north face outlet
mulberry uk
hermes belt
stuart weitzman boots
washington redskins jerseys
wei20150610

Unknown said...

2015-7-28 xiaozhengm
christian louboutin sale
polo ralph lauren outlet
longchamp outlet
michael kors handbags
coach factory outlet
replica watches cheap
ed hardy
pandora rings
tory burch shoes
ralph lauren outlet
soccer jerseys wholesale
michael kors handbag
prada handbags
cheap ray ban sunglasses
chanel outlet
hollister clothing store
burberry outlet online
tory burch outlet
cheap jerseys
tory burch outlet online
cheap jordans
ray ban outlet
coach outlet online
air max 90
ralph lauren uk
coach outlet
kate spade bags
coach outlet
nike air force
chaussure louboutin
nike air max
tory burch handbags
air max shoes
air jordan
nike blazer
nike blazer low
jordan homme
michael kors
abercrombie
gucci

oakleyses said...

nike blazer, michael kors, nike free run uk, nike air max, true religion jeans, true religion jeans, air jordan pas cher, nike air max, ralph lauren uk, timberland, air max, nike roshe, tn pas cher, louboutin pas cher, true religion outlet, vans pas cher, coach outlet, hermes, ralph lauren pas cher, nike free, coach purses, michael kors, oakley pas cher, mulberry, hollister pas cher, lacoste pas cher, new balance pas cher, ray ban pas cher, vanessa bruno, burberry, hollister, michael kors, kate spade handbags, coach outlet, abercrombie and fitch, lululemon, coach factory outlet, nike roshe run, north face, nike air max, ray ban uk, michael kors, true religion jeans, converse pas cher, north face, air force, hogan, sac longchamp, longchamp pas cher, sac guess

oakleyses said...

ugg pas cher, vans, moncler, moncler, canada goose, louis vuitton, ugg boots uk, canada goose, toms shoes, doudoune canada goose, moncler, louis vuitton, louis vuitton, ugg australia, juicy couture outlet, moncler, supra shoes, doke gabbana outlet, gucci, karen millen, moncler outlet, hollister, moncler, hollister, canada goose, louis vuitton, ray ban, marc jacobs, pandora jewelry, michael kors outlet online, moncler, swarovski crystal, pandora jewelry, wedding dresses, thomas sabo, moncler, bottes ugg, sac louis vuitton pas cher, nike air max, barbour, barbour jackets, pandora charms, canada goose outlet, canada goose uk, michael kors outlet, converse outlet, links of london, canada goose outlet, pandora charms, canada goose

Unknown said...

coach outlet online
cardinals jerseys
yeezy boost 350
coach outlet store online
ray ban sunglasses outlet
hermes outlet online
coach factory outlet online
eahawks jerseys
michael kors purse
coach outlet store online
20170310huazhen