Cross Browser Compatibility & Progressive Enhancement

隨著網路的發展,網頁所包含的不單止有文字圖案,不同種類的多媒體應用漸漸被應用於一些尖端前衛的網站上,固有的瀏覽器未必能應付這樣的需求。由Internet Explorer vs Netscape 的年代開始,瀏覽器的戰爭自此沒有停過。林林種種的瀏覽器出現,Firefox, Chrome, Safari, Opera等等,對用家來說是多了選擇,對Web Developer來說分分鐘是惡夢的開始。

假如各門路的瀏覽器能夠把任何一個網頁都一致地呈現,這是最理想的情況。但事實上各家各有自己對網頁的編譯方法,甚至運行上的不同做法,都使 Web Developer 再神勝不過。意思說,作為 Web Developer ,有責任的話,他需要讓其製作的網頁能在絕大部份的瀏覽器 / 視窗平台中順利運行,這就是所謂 Cross Browser Compatibility 。要做到這點,並不是把一切基本網頁編寫的 HTML,JavaScript 學會就是了。還得要從各個瀏覽器的特性方面著手。由標準HTML (W3C Standard HTML)學起,到逐步了解不同瀏覽器對 HTML 的演譯方法,接著學寫標準的JavaScript,並且查找某些JavaScript在不同瀏覽器中編寫文法的例外,到較後學習如何利用CSS對版面作改動,與及留意不同瀏覽器所支援的 CSS 版本,為網頁作出適當的 CSS 調整。

從前 Cross Browser Support 主要依賴人手在各個瀏覽器上作測試,而現在坊間有說多途徑去減化這些測試動作。這個網站羅列了數個測試方法:

7 Fresh and Simple Ways to Test Cross-Browser Compatibility | FreelanceFolder

詳細的不說了,重點就是作為 Web Developer ,對自己所製作的網站傑作,都應該執行 Cross Browser Compatibility 測試,好使自己的作品不會在某些執行環境中出洋相。

當然,在云云瀏覽器存在的世代,正如我說不同瀏覽器對網頁的呈現會有不同的演譯方法,然而強行要將一個網頁完全順利一式一樣的在各個瀏覽器呈現,並不是沒可能,只是不夠實制。比方說,對不同瀏覽器對網頁中的元作執位方面會有偏差,這個還不算太難應對。但對一些網站運用了許多視覺優化,如圓角表單、文字陰影、背景漸變等等,從前人們會用 Table、Div或背景圖來規劃一些組件來製作相關效果。但隨著 CSS 的廣泛應用,CSS版本進展到CSS3,利用它能夠將許多效果實現。這些進化了的效果在較舊的瀏覽器上當然未能完整呈現,但呈現出的結果因背後有 Backward Compatibility 的概念而也不算太強差人意。這個網站有提出一個例子解釋:

When Should You Use Progressive Enhancement

嗯,本文另一個字眼出現了:「Progressive Enhancement」。其大意是一個網頁的表現結果在各個瀏覽器都大致一樣,唯獨對新技術有所支援的瀏覽器中,會展示較好的呈現結果。以上網站顯示了一個表單資料的顯示情況。用較新的瀏覽器觀看網站,會得到較漂亮的版面,然而在較舊的瀏覽器中,亦不失其功能上的表現。當然,對於一些不明白上文所述的一切,又要要求 Web Developer 把網頁做到在任何網站一式一樣的老闆來說,那只有苦了該 Web Developer 去花心機時間做盡一切方法將其老闆的想法實現。

HTML5 vs Flash

算不上是什麼 web development 方面的技術差異的偉大分享,以上純綷是個人對 FLASH 和 HTML5 的一點看法。

雖然花了一段時間學習 HTML5 ,算不上上手,而另一方面則利用 ActionScript 寫了數年 FLASH。老實說,當初還使用著Pentium II 有256MB記憶體的年代,我對FLASH頗有微言。每每遇著一些無謂的網站開場動畫,光飛了些字然後才能進入網站,這些多餘的步驟其FLASH動畫經已耗掉我那台電腦的大部份資源,該些網頁看下去也沒意思。可是,當慢慢接觸多些比較有深度,可看出製作時花了不少心思的FLASH SITE(整個站台也是FLASH建構),與及隨著科技日新月異而多番昇級電腦機件,才能漸漸意會 FLASH 能帶給網路使用者更高層次的視覺享受和使用經歷(Site User Experience)。

無疑,FLASH 的確對其運行的電腦有一定的資源需求。很公平,有華麗效果當然需要相對的運算能力來造就。就正如你也不可能期望飛機能單靠那四個引擎飛上大空,總得附上兩三節推進器來看離地球擺脫地心吸力吧。然而在 HTML5 漸露頭角,人們一窩峰清算 FLASH 如何耗能,預測 HTML5 如何能替代 FLASH 的地位,我倒覺得這還有一段很長的路途。因為就算 HTML5 配搭 JavaScript 可達到編程層次來呈現互動效果,但單靠各家的瀏覽器來作為運行介面,總比不上 FLASH 利用自家經優化運行的 FLASH PLAYER 來執行運算程序來呈現效果來得可靠。FLASH PLAYER 對不同平台為 FLASH 檔案提供相對應的優化,有 ADOBE 來進行技術圍護和發展,這是 FLASH 能由簡單的動畫短片表現界系進化到站台開發與及互聯網應用軟體應用這一個廣域應用。

在細小的網站開發,HTML5可能讓網頁開發員花一點小功夫來把網站變得較美觀和添加互動元素。但論及大型網站開發,現階段 FLASH 仍然勝於 HTML5,至少Flash IDE 能提供一個比較完善的開發介面。

這寫分享其實出於為 FLASH 抱不平的心態,一些人對 FLASH 反感實在只是出於偏見。然而人們若能夠以開放的心態去了解 FLASH 這一門和學習如何好好應用 FLASH 來弄網站,這才能真正讓網頁開發的將來大放異彩。

海洋公園哈囉喂2010宣傳片製作特輯

這一趟實在是首次了解海洋公園哈囉喂是何方神聖。看過這個製作特輯,的確引起我有一份到海洋公園撞撞鬼的衝動。這麼一個哈囉喂,稍稍找找資料不難知道這是當年令海洋公園經歷財困之時起死回生的其中一項項目之一。這麼一轉眼經過十年的進化,由那時的簡單鬼屋谷夜場人氣,到近年愈玩愈出軌,引入鬼后鬼舞,挑戰公共廣播宣傳的尺度,為求越界愈盞鬼。海洋公園我真的佩服你!
Continue reading 海洋公園哈囉喂2010宣傳片製作特輯

Pass parameter to setTimeout

setTimeout is a very general function in JavaScript which delay an execuation of a portion of code/ function call. And I used it in ActionScript as well so I was deeply get used to write the function in this format:

var param = “Hello”;

var timer = setTimeout(function(inParam){

//coding

}, 1000,  param);

Where ‘param’ is the parameter I wish to pass into the function with variable ‘inParam’ for further processing.

I didn’t realize until today I run it in IE, I got the hasty yellow exclamation mark on the left bottom status bar, saying the variable ‘inParam’ is undefined. Eventually I googled it and found that IE did a great job that she stand out from the browser keep not supporting the above syntax for passing parameter to setTimeout(). Or maybe it is too kind for other browsers to provide the above method for developer to write rapid parameter passing code.

The work around for IE to allow passing parameter to setTimeout function is:

var param = “Hello”;

var fnc = function(inParam){

//coding with the use of inParam

}

var timer = setTimeout(function(){

fnc(param);

}, 1000);

Or it is the time for me to use this complicate syntax to fit for all browsers~

Move from PHP to JSP, the starting point of learning thing in all new

It has been around 8 years I work with PHP + MySQL, with additional technique like ActionScript 2.0/3.0 and Flex, jQuery, Ajax to enhance the front-end design, I start exploring a new era in my life recently, the JSP and related knowledges.

When talking JSP, JAVA is involved as well. I didn’t learn JAVA with a complete course, so does JSP. At first I think ‘they are just programming language, it shouldn’t be hard to master it as long as it is Object-Oriented Programming language. But the more I read about JSP/JAVA, the more unclearness I encountered, and it really a tough stuff to master, especially there are many new concepts that are different from PHP or MC++.

The first step to master JAVA/JSP is to setup an environment for running your test script/sample script. Setting ‘JAVA_HOME’ is not difficult, but for some package code, it is far from easy to make the stuffs work finally. ‘Servlet, JavaBean’ those are new idea to me. Server like Tomcat/jBoss keep surrounding my mind without figuring them out clearly. It makes me more agree with that, despite the scalability of JAVA is far stronger than PHP, PHP make rich internet application development much easier.

I am still on the path of learning JAVA, JSP, Servlet. Hope to see anyone who skillful in PHP can provide easier way in mastering JSP.

What should a Front End Web Developer be?

Previouly I was a guy being called as Interactive Developer, help previous boss making his cool stuffs from concept into similar real visualization, no matter using ActionScript 3 to write Flash or using jQuery to write XHTML. Now come to a new job titled as Front End Web Developer, I try to look deeper in what the role should a Front End Web Developer be.
Continue reading What should a Front End Web Developer be?

An evolution of Gordon Chan

How often do you concern about your name or brand nam ethat you own? Have you ever check your name in some search engine so as to know who call the same?

Just a search with a keyword “Gordon Chan”, a name that followed me at least 15 years from my primary school, is not that simple:

  • Gordon Chan is a famious Hong Kong film director, 陳嘉上
  • Gordon Chan is a real estate agent in Canada
  • Gordon Chan is an academic staff/doctor/PhD belong to the department of oncology in the University of Alberta in Canada
  • Gordon Chan is the Principal of FCGA in Canada
  • Gordon Chan is also an artistic hair designer, etc.

Wow, and now, I would like to introduce myself into the world of Gordon Chan:
Gordon Chan is a Web Developer who keen on exploring the possibility of web authoring with passion on making the world of website to be better suit for various clients and visitors’ need.

For the last 12 years, I start building website using FrontPage Express, FrontPage, and later on using Adobe Dreamweaver, or even just Notepad2 for web authoring, I can see how the world of web development change. I cannot say I can bring any new technology advance, I can at least make use of new techniques with standard code style so as to make good works and let visitors to have fun in my works. And now it comes to the time that I start using my name as the brand for my works, and hope in the up-coming future people will know more about me, not a film director/doctor/agent or designer, but a specialist, web developer.