tag:blogger.com,1999:blog-35000490699794314102024-03-13T10:04:01.178+08:00Oh~! ZiwayAnonymoushttp://www.blogger.com/profile/14418663829820184628noreply@blogger.comBlogger443125tag:blogger.com,1999:blog-3500049069979431410.post-7556470651159691402013-11-09T19:08:00.001+08:002013-11-09T19:08:10.241+08:00選擇 IDE 的評估項目1. 針對特定語言執行測試的便利性<br />
2. 針對特定語言 Debug 工具的便利性<br />
3. 與現有版本控制工具的支援程度Anonymoushttp://www.blogger.com/profile/14418663829820184628noreply@blogger.com0tag:blogger.com,1999:blog-3500049069979431410.post-63330537562662013052013-10-08T17:06:00.000+08:002013-10-22T16:25:04.269+08:00Firefox 和 Chrome 不支援 IPv6 Link-Local Address + Scope ID 的原因因為 RFC3986 中對於 % 使用的規定,Firefox 和 Chrome 並不支援 URI 使用 IPv6 Link-Local Address + Scope ID (Firefox 曾經在一些版本中有支援但後來已移除)。<br />
不過因為 RFC6874 的定義,未來大家應該都會支援在 URI 使用 IPv6 Link-Local Address + Scope ID。<br />
<br />
Reference:<br />
<a href="http://code.google.com/p/chromium/issues/detail?id=70762" target="_blank">http://code.google.com/p/chromium/issues/detail?id=70762</a><br />
<a href="http://tools.ietf.org/html/rfc3986" target="_blank">http://tools.ietf.org/html/rfc3986</a><br />
<a href="http://tools.ietf.org/html/rfc6874" target="_blank">http://tools.ietf.org/html/rfc6874</a>Anonymoushttp://www.blogger.com/profile/14418663829820184628noreply@blogger.com0tag:blogger.com,1999:blog-3500049069979431410.post-51950933759200565122013-10-08T14:25:00.001+08:002013-10-08T14:25:18.709+08:00window.location.hostname 遇到 IPv6 Address 的相容性問題當我們在瀏覽器輸入 IPv6 的 Address 時前後會帶中括號 [] 將 IPv6 的 Address 包起來,<br />
但相同的 IPv6 URI,當我們用 window.location.hostname 取值時,不同瀏覽器上會回傳不同的字串。<br />
<br />
在 IE 和 Firefox 回傳的 IPv6 Address 沒有帶中括號。<br />
但 Chrome 回傳的有。<br />
<br />
當我們使用 window.location.href 時,如果 URI 中有包含 IPv6 的 Address 時,則不管什麼瀏覽器都要帶 [] 中括號才能正常的運作。<br />
<br />
以後應該會統一,但目前在透過 JavaScript 作頁面轉換處理時要注意。<br />
<br />
Reference:<br />
<a href="http://lists.w3.org/Archives/Public/public-html/2010Dec/0183.html" target="_blank">http://lists.w3.org/Archives/Public/public-html/2010Dec/0183.html</a>Anonymoushttp://www.blogger.com/profile/14418663829820184628noreply@blogger.com0tag:blogger.com,1999:blog-3500049069979431410.post-24175853704135581182013-09-24T20:57:00.000+08:002013-09-24T20:57:36.971+08:00程式設計筆記前陣子讀了 2/3 的 Clean Code 補了不少 coding 的觀念 (Java 的部分我不熟,所以跟 Java 相關的我直接跳過),接連兩天的 Code Review 會議又聽到了一些不錯的觀念,就筆記一下。<br />
<br />
A. 盡可能在設計時要考慮到 <br />
1. 簡化流程<br />
2. 保持彈性<br />
3. 提高擴充性<br />
<br />
B. 提高資料的描述性方便取用<br />
1. 變數名稱<br />
2. 物件封裝<br />
<br />
C. 處理最大量資料的效率<br />
<br />
D. 變數或函式取名時可以參考其他語言常見或既有的名稱,提高可讀性 Anonymoushttp://www.blogger.com/profile/14418663829820184628noreply@blogger.com0tag:blogger.com,1999:blog-3500049069979431410.post-20494433415617889072013-08-19T11:43:00.001+08:002013-08-19T11:43:15.070+08:00什麼是程式設計師最重要的技能1. 對程式語言的熟悉<br />
2. 對整個平台運作的熟悉<br />
3. 熱情<br />
4. 溝通<br />
<br />
但最重要的是溝通!<br />
<br />
Reference:<br />
<a href="http://www.techbang.com/posts/14478-program-designers-of-the-most-important-skills" target="_blank">http://www.techbang.com/posts/14478-program-designers-of-the-most-important-skills</a>Anonymoushttp://www.blogger.com/profile/14418663829820184628noreply@blogger.com0tag:blogger.com,1999:blog-3500049069979431410.post-91510186279138322012013-08-17T22:45:00.000+08:002013-08-17T22:45:39.712+08:00使用 encodeURIComponent 將字串傳換為 URI 要將空白換成+<br />
##<br />
For <code>application/x-www-form-urlencoded</code> (POST), spaces are to be replaced by '+', so one may wish to follow a <code>encodeURIComponent</code> replacement with an additional replacement of "%20" with "+". <br />
##<br />
<br />
Reference:<br />
<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent" target="_blank">https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent</a><br />
<a href="http://www.w3.org/TR/html401/interact/forms.html#form-content-type" target="_blank">http://www.w3.org/TR/html401/interact/forms.html#form-content-type</a>Anonymoushttp://www.blogger.com/profile/14418663829820184628noreply@blogger.com0tag:blogger.com,1999:blog-3500049069979431410.post-24528566037755744872013-08-13T17:01:00.000+08:002013-08-13T17:18:03.856+08:00Boundary Test (Error Handling)評估資料來源,是否確定一定不會有例外資料進來,如果不會有,就不用檢查,如果資料來源有可能超乎預期,就要檢查。<br />
<br />
也或者說提供別人呼叫的 API 都要檢查進來的資料最保險。 <br />
<br />
1. Web UI<br />
2. CGI (HTTP 的 Request 不一定來自瀏覽器,也可以擷取封包自己塞資料)<br />
3. APIAnonymoushttp://www.blogger.com/profile/14418663829820184628noreply@blogger.com0tag:blogger.com,1999:blog-3500049069979431410.post-21024914710895348522013-08-13T10:32:00.002+08:002013-08-13T10:32:28.087+08:00處理字串和記憶體時的保護性寫法當我們在處理字串或記憶體時盡量使用保護性的寫法,可以減少 Overflow 或 Overlap 的機會。<br />
<br />
<div class="MsoPlainText">
1.<span lang="EN-US" style="mso-bidi-font-family: 細明體; mso-hansi-font-family: 細明體;"> 使用可以掌握資料長度的寫法</span></div>
<div class="MsoPlainText">
<span lang="EN-US" style="mso-bidi-font-family: 細明體; mso-hansi-font-family: 細明體;">memcpy</span></div>
<br />
<div class="MsoPlainText">
<span lang="EN-US" style="mso-bidi-font-family: 細明體; mso-hansi-font-family: 細明體;"></span></div>
<div class="MsoPlainText">
<span lang="EN-US" style="mso-bidi-font-family: 細明體; mso-hansi-font-family: 細明體;">strncpy </span></div>
<div class="MsoPlainText">
<span lang="EN-US" style="mso-bidi-font-family: 細明體; mso-hansi-font-family: 細明體;"></span><span lang="EN-US" style="font-family: Wingdings; mso-ascii-font-family: 細明體; mso-bidi-font-family: 細明體; mso-char-type: symbol; mso-hansi-font-family: 細明體; mso-symbol-font-family: Wingdings;"><span style="mso-char-type: symbol; mso-symbol-font-family: Wingdings;"></span></span><span lang="EN-US" style="mso-bidi-font-family: 細明體; mso-hansi-font-family: 細明體;">strncat</span><span style="mso-bidi-font-family: 細明體; mso-hansi-font-family: 細明體;"><span lang="EN-US"></span></span></div>
<div class="MsoPlainText">
<span lang="EN-US" style="mso-bidi-font-family: 細明體; mso-hansi-font-family: 細明體;"></span><span lang="EN-US" style="font-family: Wingdings; mso-ascii-font-family: 細明體; mso-bidi-font-family: 細明體; mso-char-type: symbol; mso-hansi-font-family: 細明體; mso-symbol-font-family: Wingdings;"><span style="mso-char-type: symbol; mso-symbol-font-family: Wingdings;"></span></span><span lang="EN-US" style="mso-bidi-font-family: 細明體; mso-hansi-font-family: 細明體;">snprintf</span></div>
<div class="MsoPlainText">
<br /></div>
<div class="MsoPlainText">
<span lang="EN-US" style="mso-bidi-font-family: 細明體; mso-hansi-font-family: 細明體;">2. 使用可以暫存資料位址的寫法</span></div>
<div class="MsoPlainText">
<span lang="EN-US" style="mso-bidi-font-family: 細明體; mso-hansi-font-family: 細明體;">strtok_r</span></div>
<div class="MsoPlainText">
<br /></div>
<div class="MsoPlainText">
<span lang="EN-US" style="mso-bidi-font-family: 細明體; mso-hansi-font-family: 細明體;">3. 檢查字串是否包含 '\0' </span></div>
Anonymoushttp://www.blogger.com/profile/14418663829820184628noreply@blogger.com0tag:blogger.com,1999:blog-3500049069979431410.post-10802474548077165102013-08-13T10:21:00.000+08:002013-08-13T10:21:04.674+08:00透過 HTTP 傳送資料給 CGI 的注意事項Web 用戶端 (瀏覽器) 可以透過 HTTP Get 或 Post 的方式將資料傳送給 Server 的 CGI 處理。<br />
但我們也可以透過仿造 URL 或擷取封包修改內容的方式,將修改過後的內容傳送給 Server,不經由原本用戶端的 Form 或 JavaScript。因此除了在用戶端驗證資料的正確性與合法性,也必須在 Server 端作相同的驗證。<br />
<br />
以下舉出幾種必須驗證的 Case:<br />
<br />
1. 資料長度太長。<br />
2. CGI 要接收數字但傳送過來的資料包含數字與其他字符。<br />
3. 資料沒有落在定義的範圍中。<br />
4. 沒有限制接收檔案的大小。<br />
<br />
如果涉及敏感的資料如帳號密碼,必須要先加密後再傳輸。<br />
Anonymoushttp://www.blogger.com/profile/14418663829820184628noreply@blogger.com0tag:blogger.com,1999:blog-3500049069979431410.post-31965607651795538392013-08-01T11:19:00.001+08:002013-08-01T11:19:47.923+08:00Cookie 在 HTTP 和 HTTPS 間的使用限制在相同 Domain 的情況下:<br />
<ul>
<li><strong>HTTP</strong> Cookie, <strong>with "Secure"</strong> will be returned only on <strong>HTTPS</strong> connections (pointless to do this)</li>
<li><strong>HTTPS</strong> Cookie, <strong>with "Secure"</strong> will be returned only on <strong>HTTPS</strong> connections</li>
<li><strong>HTTP</strong> Cookie, <strong>without "Secure"</strong> will be returned on <strong>HTTP</strong> or <strong>HTTPS</strong> connections</li>
<li><strong>HTTPS</strong> Cookie, <strong>without "Secure"</strong> will be returned on <strong>HTTP</strong> or <strong>HTTPS</strong> connections (could leak secure information)</li>
</ul>
<br />
Reference:<br />
<a href="http://stackoverflow.com/questions/2163828/reading-cookies-via-https-that-were-set-using-http" target="_blank">http://stackoverflow.com/questions/2163828/reading-cookies-via-https-that-were-set-using-http</a><br />
RFC2965 3.3 <br />
Anonymoushttp://www.blogger.com/profile/14418663829820184628noreply@blogger.com0tag:blogger.com,1999:blog-3500049069979431410.post-50226837603007082002013-08-01T10:53:00.000+08:002013-08-17T23:44:51.087+08:00Same-Origine Policy在 JavaScript 中有 Origine 的限制,可以參考以下的條件:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-JKEwWkoEPhQ/UfnL33eDnVI/AAAAAAAABjA/yjXBatABhzw/s1600/Screenshot+-+2013_8_1+,+%E4%B8%8A%E5%8D%88+10_44_05.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="190" src="http://3.bp.blogspot.com/-JKEwWkoEPhQ/UfnL33eDnVI/AAAAAAAABjA/yjXBatABhzw/s640/Screenshot+-+2013_8_1+,+%E4%B8%8A%E5%8D%88+10_44_05.png" width="640" /></a></div>
<br />
目前查到的解決方法有三種: <br />
1. JSONP 但只限制用 HTTP Get 取得資料<br />
2. Iframe or Form DOM 的 submit (網頁會 Reload,所以不受 Origin 的限制)<br />
3. 在 Server 端設定 Cross-Origin Resource Sharing (CORS)<br />
<br />
PS. AJAX 會受到 Origin 的限制<br />
<br />
Reference:<br />
<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Same_origin_policy_for_JavaScript" target="_blank">https://developer.mozilla.org/en-US/docs/Web/JavaScript/Same_origin_policy_for_JavaScript</a><br />
<a href="https://developer.mozilla.org/en-US/docs/HTTP/Access_control_CORS" target="_blank">https://developer.mozilla.org/en-US/docs/HTTP/Access_control_CORS</a>Anonymoushttp://www.blogger.com/profile/14418663829820184628noreply@blogger.com0tag:blogger.com,1999:blog-3500049069979431410.post-18503947830128875152013-07-15T14:43:00.000+08:002013-08-01T10:54:57.674+08:00興趣與職涯規劃最近開始思考未來,讀了一些文章心得如下:<br />
<br />
1. 在興趣、能力 (經常被主管稱許的地方)、市場需求間取得交集<br />
<br />
2. 興趣、未來性、不可取代性比薪水重要<br />
<br />
3. 用要與不要,加上關鍵字歸納出大方向與縮小範圍<br />
<br />
Reference:<br />
<a href="http://blog.yam.com/tzaralin/article/64336974" target="_blank">http://blog.yam.com/tzaralin/article/64336974</a><br />
<a href="http://www.projectup.net/blog/index.php?option=com_content&view=article&id=13676%3A2013-07-14-16-05-49&catid=9%3Alife&Itemid=25&utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+projectup%2FWDNW+%28%E5%B0%88%E6%A1%88%E7%AE%A1%E7%90%86%E7%9A%84%E7%94%9F%E6%B4%BB%E6%80%9D%E7%B6%AD%29" target="_blank">找不到理想與熱情?你需要第二次「抓周」!</a><br />
<a href="http://www.projectup.net/blog/index.php?option=com_content&view=article&id=339:2010-06-22-07-37-33&catid=9:life&Itemid=25" target="_blank">找出生涯規劃的關鍵字</a><br />
<a href="http://www.projectup.net/blog/index.php?option=com_content&view=article&id=9651:2012-05-30-03-23-26&catid=9:life&Itemid=25" target="_blank">三個圈畫出你的領域</a>Anonymoushttp://www.blogger.com/profile/14418663829820184628noreply@blogger.com0tag:blogger.com,1999:blog-3500049069979431410.post-57459573618813940582013-07-14T22:35:00.002+08:002013-07-14T22:35:53.026+08:00如何修改或取得 HTML Element 中的文字內容1. innerHTML<br />
<br />
2. nodeValue => 因為 HTML Element 中的文字內容也算是一個 Node<br />
ex.<br />
<div>
test1<span>test2</span>test3</div>
<br />
包含了三個 Node:<br />
a. test1<br />
b. <span></span><br />
c. test3<br />
<br />
Reference:<br />
<a href="http://www.w3schools.com/htmldom/dom_properties.asp" target="_blank">http://www.w3schools.com/htmldom/dom_properties.asp</a><br />
<a href="http://javascript.info/tutorial/basic-dom-node-properties" target="_blank">http://javascript.info/tutorial/basic-dom-node-properties</a>Anonymoushttp://www.blogger.com/profile/14418663829820184628noreply@blogger.com0tag:blogger.com,1999:blog-3500049069979431410.post-65051055739040995352013-07-09T15:02:00.000+08:002013-07-09T15:02:14.770+08:00Msxml2.XMLHTTP 與 Microsoft.XmlHttp 的差異在撰寫 AJAX 使用 XMLHttpRequest 物件時,同時必須要考慮到的瀏覽器相容性問題。<br />
<br />
當我們使用<span class="typ"> ActiveXObject 時蠻常遇到的疑惑就是 Msxml2.XMLHTTP 與 Microsoft.XmlHttp 的差異。</span><br />
<span class="typ"><br /></span>
<span class="typ">簡單的說就是版本的差異,相對地跟相容性有關。</span><br />
<span class="typ"><br /></span>
<span class="typ">Reference:</span><br />
<span class="typ"><a href="http://msdn.microsoft.com/en-us/library/ie/ms535874%28v=vs.85%29.aspx" target="_blank">http://msdn.microsoft.com/en-us/library/ie/ms535874%28v=vs.85%29.aspx</a></span><br />
<span class="typ"><a href="http://forums.asp.net/t/1000060.aspx/3/10" target="_blank">http://forums.asp.net/t/1000060.aspx/3/10</a></span>Anonymoushttp://www.blogger.com/profile/14418663829820184628noreply@blogger.com0tag:blogger.com,1999:blog-3500049069979431410.post-15667696937676095472013-06-27T23:31:00.003+08:002013-06-27T23:31:47.808+08:00Register Event Handler1. [Element].onevent<br />
<br />
在 IE8 以前的瀏覽器上有一些奇怪的限制,如:在 Iframe Element上不允許註冊 onload<br />
<br />
2. [Element].addEventListener<br />
3. [Element].attachEvent<br />
<br />
使用 2 或 3 註冊又可以分成三種方式<br />
<br />
A. Anonymous: function(){...}<br />
a. 不會被立即執行<br />
b. 無法被移除<br />
<br />
B. Function Reference: [Function Name]<br />
a. 不會被立即執行<br />
b. 無法帶參數<br />
<br />
C. Function Call: [Function Name]()<br />
a. 會被立即執行<br />
b. 可以帶參數Anonymoushttp://www.blogger.com/profile/14418663829820184628noreply@blogger.com0tag:blogger.com,1999:blog-3500049069979431410.post-72854086732510666662013-06-25T23:04:00.000+08:002013-06-25T23:04:01.000+08:00開放的 DNS Server <div style="-webkit-text-stroke-width: 0px; background-color: white; color: #515151; font-family: Georgia, serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 25.59375px; margin: 0px 0px 1.8em; orphans: auto; padding: 0px; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;">
<strong style="margin: 0px; padding: 0px;">Google DNS</strong></div>
<div style="-webkit-text-stroke-width: 0px; background-color: white; color: #515151; font-family: Georgia, serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 25.59375px; margin: 0px 0px 1.8em; orphans: auto; padding: 0px; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;">
Preferred: 8.8.8.8<br style="margin: 0px; padding: 0px;" />Alternate: 8.8.4.4</div>
<div style="-webkit-text-stroke-width: 0px; background-color: white; color: #515151; font-family: Georgia, serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 25.59375px; margin: 0px 0px 1.8em; orphans: auto; padding: 0px; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;">
<strong style="margin: 0px; padding: 0px;">OpenDNS</strong></div>
<div style="-webkit-text-stroke-width: 0px; background-color: white; color: #515151; font-family: Georgia, serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 25.59375px; margin: 0px 0px 1.8em; orphans: auto; padding: 0px; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;">
Preferred: 208.67.222.222<br style="margin: 0px; padding: 0px;" />Alternate: 208.67.220.220</div>
<div style="-webkit-text-stroke-width: 0px; background-color: white; color: #515151; font-family: Georgia, serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 25.59375px; margin: 0px 0px 1.8em; orphans: auto; padding: 0px; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;">
Reference: http://getpocket.com/a/read/383826640 </div>
Anonymoushttp://www.blogger.com/profile/14418663829820184628noreply@blogger.com0tag:blogger.com,1999:blog-3500049069979431410.post-92081587938545365262013-06-19T14:37:00.002+08:002013-06-21T11:29:15.303+08:00Web 相關的保留字Cookie 的保留字 = 和 ;<br />
URL 的保留字 ? & =<br />
HTML 保留字 " ' & < ><br />
<br />
更詳細的可以 Reference: rfc3986 Anonymoushttp://www.blogger.com/profile/14418663829820184628noreply@blogger.com0tag:blogger.com,1999:blog-3500049069979431410.post-80524639947287694972013-05-09T11:36:00.002+08:002013-05-09T11:36:38.166+08:00Web 控制 Browser Cache 的方式<pre class="lang-html prettyprint prettyprinted"><code><span class="tag"><span class="pln"> </span><span class="atn">http-equiv</span><span class="pun">=</span><span class="atv">"Cache-Control"</span><span class="pln"> </span><span class="atn">content</span><span class="pun">=</span><span class="atv">"no-cache, no-store, must-revalidate"</span><span class="pln"> </span><span class="tag">/></span><span class="pln">
</span><span class="tag"><span class="pln"> </span><span class="atn">http-equiv</span><span class="pun">=</span><span class="atv">"Pragma"</span><span class="pln"> </span><span class="atn">content</span><span class="pun">=</span><span class="atv">"no-cache"</span><span class="pln"> </span><span class="tag">/></span><span class="pln">
</span><span class="tag"><span class="pln"> </span><span class="atn">http-equiv</span><span class="pun">=</span><span class="atv">"Expires"</span><span class="pln"> </span><span class="atn">content</span><span class="pun">=</span><span class="atv">"0"</span><span class="pln"> </span><span class="tag">/></span></span></span></span></code></pre>
<pre class="lang-html prettyprint prettyprinted"><code><span class="tag"> </span></code></pre>
<pre class="lang-html prettyprint prettyprinted"><code><span class="tag"> </span></code></pre>
<pre class="lang-html prettyprint prettyprinted"><code><span class="tag">Reference:</span></code></pre>
<pre class="lang-html prettyprint prettyprinted"><code><span class="tag"><a href="https://developer.mozilla.org/en-US/docs/HTTP_Caching_FAQ" target="_blank">https://developer.mozilla.org/en-US/docs/HTTP_Caching_FAQ</a></span></code></pre>
<pre class="lang-html prettyprint prettyprinted"><code><span class="tag"><a href="http://hungred.com/how-to/tutorial-stop-caching-jquery-javascript/" target="_blank">http://hungred.com/how-to/tutorial-stop-caching-jquery-javascript/</a></span></code></pre>
<pre class="lang-html prettyprint prettyprinted"><code><span class="tag"><a href="http://stackoverflow.com/questions/49547/making-sure-a-web-page-is-not-cached-across-all-browsers" target="_blank">http://stackoverflow.com/questions/49547/making-sure-a-web-page-is-not-cached-across-all-browsers</a></span></code></pre>
<pre class="lang-html prettyprint prettyprinted"><code><span class="tag"> </span></code></pre>
Anonymoushttp://www.blogger.com/profile/14418663829820184628noreply@blogger.com0tag:blogger.com,1999:blog-3500049069979431410.post-30677513153488756042013-05-07T10:34:00.002+08:002013-05-07T10:34:31.354+08:00可以在 Client 端暫存資料的地方要在 Client 端的瀏覽器暫存資料,不受瀏覽器 Reload 的影響可以利用:<br />
<br />
1. Address Bar (帶在 URL 中)<br />
2. Cookie<br />
<br />
暫存的資料需考慮安全性問題。<br />
Anonymoushttp://www.blogger.com/profile/14418663829820184628noreply@blogger.com0tag:blogger.com,1999:blog-3500049069979431410.post-66353175628772656862013-02-24T12:53:00.002+08:002013-02-24T12:53:40.996+08:00產生 Event 並傳送給指定的 Element<br />
1. Create event<br />
<br />
createEvent / createEventObject<br />
<br />
2. Initial event<br />
根據我們建立 Event 的方式決定初始化的方式<br />
<br />
3. Dispatch event<br />
dispatchEvent / fireEvent<br />
<br />
PS. 要考慮到瀏覽器相容性的問題。Anonymoushttp://www.blogger.com/profile/14418663829820184628noreply@blogger.com0tag:blogger.com,1999:blog-3500049069979431410.post-19587508696311295002013-02-18T16:07:00.001+08:002013-02-18T16:07:29.331+08:00網頁上英文字因為換行被截斷的問題CSS 的解法:<br />
<br />
word-break<br />
word-wrap<br />
<br />
JavaScript 的解法:<br />
<br />
style.wordBreak<br />
style.wordWrapAnonymoushttp://www.blogger.com/profile/14418663829820184628noreply@blogger.com0tag:blogger.com,1999:blog-3500049069979431410.post-20793977650954736192013-02-05T17:52:00.000+08:002013-02-05T17:52:09.630+08:00在 Firefox 3.5 上遇到的 reload 問題##<br />
<div class="post-text">
you might call the same page but let it look like it is an <em>other</em> page by changing the querystring:<br />
<pre class="default prettyprint prettyprinted"><code><span class="pln">window</span><span class="pun">.</span><span class="pln">location</span><span class="pun">.</span><span class="pln">href </span><span class="pun">=</span><span class="pln"> </span><span class="str">"index.html"</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> </span><span class="str">"?"</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> </span><span class="typ">Date</span><span class="pun">.</span><span class="pln">parse</span><span class="pun">(</span><span class="kwd">new</span><span class="pln"> </span><span class="typ">Date</span><span class="pun">());</span></code></pre>
This works for every browser. You could improve it by extracting the current page out of <code>location.href</code>.<br />
<strong>Edit:</strong><br />
If you already have an existing querystring you have to use <code>&</code> insead of <code>?</code>:<br />
<pre class="default prettyprint prettyprinted"><code><span class="pln">window</span><span class="pun">.</span><span class="pln">location</span><span class="pun">.</span><span class="pln">href </span><span class="pun">=</span><span class="pln"> </span><span class="str">"product.aspx?id=prod"</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> </span><span class="str">"&"</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> </span><span class="typ">Date</span><span class="pun">.</span><span class="pln">parse</span><span class="pun">(</span><span class="kwd">new</span><span class="pln"> </span><span class="typ">Date</span><span class="pun">());</span></code></pre>
</div>
##<br />
<br />
Reference:<br />
<a href="http://stackoverflow.com/questions/1536900/force-a-page-refresh-using-javascript-in-firefox" target="_blank">http://stackoverflow.com/questions/1536900/force-a-page-refresh-using-javascript-in-firefox</a>Anonymoushttp://www.blogger.com/profile/14418663829820184628noreply@blogger.com0tag:blogger.com,1999:blog-3500049069979431410.post-47357543461958563472013-01-27T15:52:00.001+08:002013-01-27T15:52:49.829+08:00Browser Cache<br />
<br />
<ul>
<li><strong><code>public</code></strong> — marks authenticated responses as cacheable;
normally, if HTTP authentication is required, responses are automatically private.</li>
<li><strong><code>private</code></strong> — allows caches that are specific to one user (e.g., in a
browser) to store the response; shared caches (e.g., in a proxy) may not.</li>
<li><strong><code>no-cache</code></strong> — forces caches to submit the request to the
origin server for validation before releasing a cached copy, every time.
This is useful to assure that authentication is respected (in combination
with public), or to maintain rigid freshness, without sacrificing all of the
benefits of caching.</li>
<li><strong><code>no-store</code></strong> — instructs caches not to keep a copy of the
representation under any conditions.</li>
</ul>
<br />
Reference:<br />
<a href="http://www.mnot.net/cache_docs/#CACHE-CONTROL" target="_blank">http://www.mnot.net/cache_docs/#CACHE-CONTROL</a>Anonymoushttp://www.blogger.com/profile/14418663829820184628noreply@blogger.com0tag:blogger.com,1999:blog-3500049069979431410.post-38074439435496154032013-01-26T17:00:00.001+08:002013-01-26T17:00:11.960+08:00如何擷取 Browser 可以顯示的寬度和高度 (考量到多螢幕環境)<br />
Firefox、Chrome、IE9:<br />
<br />
<br />
window.top.innerWidth<br />
window.top.innerHeight<br />
<br />
<br />
IE8 and previous version:<br />
<br />
window.top.document.body.clientWidth<br />
window.top.document.body.clientHeightAnonymoushttp://www.blogger.com/profile/14418663829820184628noreply@blogger.com0tag:blogger.com,1999:blog-3500049069979431410.post-8809171302935270882013-01-23T17:15:00.004+08:002013-01-23T17:15:55.989+08:00Event Handler 如何取得發生 event 的物件1. this (有瀏覽器相容性的問題)<br />
2. event.<a href="http://help.dottoro.com/ljahrnvn.php">srcElement</a><br />
3. event.targetAnonymoushttp://www.blogger.com/profile/14418663829820184628noreply@blogger.com1