Making a html page as googlepages homepage

UPDATE 2: You can try out Roberts way, I have also tried it and it works. Use META tags <meta HTTP-EQUIV="Refresh" CONTENT="0; URL=foo.html" /> in the first block of html and it works. A bit slow but at least Page Creator doesn't wipe it.

UPDATE 1: This hack no longer works. The new version of googlepages cleans all javascript inside CSS. Though my page still works :)

It's been almost 5 days since I have been trying to change the homepage of my googlepages to an html page. This seems like a trivial task, write a line of JavaScript and you are done. But it's a lot tougher than it seems, since you cannot use any JavaScript with the pages created with Google page creator. I searched a lot on this topic; I know it's not something to loose sleep about but then again such a trivial task umm... There has to be a way out and I was determined to find a way out.

Before I tell you how I achieved it and you start abusing me right left and center have a look at my hompage. And luckily for me if you were using Internet Explorer 6 or lower you would be redirected to index.htm. It can also work with some other browsers but I just wanted to prove that it can be done. Sorry it won't work with firefox I've tried a lot; damn those guys don't have that many bugs... err.. features in their browser.

It uses the bug/feature in Internet Explorer 6 to achieve it. Open Google page creator and select any field and click "Edit Html". Insert this code there.
<div id="expression" style="display: none; style="background: transparent url(javascript:window.location=document.all.expression.innerHTML);"
>index.htm</div>


If you have a look at source code of this page http://vivekjishtu.googlepages.com/home you will see I am using "eval", but after I created this page it stopped working. Though it works on this page but every other page I created "eval" was being stripped?

So finally I tried this magical line and it works in IE6, it can also work in another browser if you use document.getElementById instead of document.all. I have tried it out and it works, but this is just a concept to prove that somthing like this can be done.

Technorati Tags: , ,

Comments

LLAMASEX said…
Very clever, I was trying to do this exact same thing and could not for the life of me get it to work. Thanks for the tip.
Anonymous said…
why don't you just leave an "enter" link. sure its tacky, but it will work in all browsers and its really easy. not everyone runs windows.
VJ said…
If you visit the site there is an "enter" link also. Incase you use IE it will automatically redirect 80% of the population. For the rest 20% of the population there is the
"enter" link. But again this is just a proof of concept that something like this can be done.
Kathy said…
I copied that div element exactly as you specified into my page, and when I published the page, googlepages modified it to this:

<div id="expression" style="DISPLAY: none; style: " background>index.html</div>

and it didn't work.
Anonymous said…
You can use any javascript in google pages, just don't use the integrated editor. Edit the page in your favorite HTML editor and upload it as you do with images, you can then view the page.
VJ said…
The trouble is not the pages you make on your computer but th pages that you made using the integrated editor. The home page cannot be set as an HTML that you have developed and that is why this hack was there.
Anonymous said…
I just put in a standard:
<META HTTP-EQUIV="Refresh"
CONTENT="0; URL=foo.html"
in the first block of html and it
works. A bit slow but at least
Page Creator doesn't wipe it.

Popular posts from this blog

The best mobile development platform for hobbyist programmer

Using Voicemail with Airtel Prepaid Karnataka

Airtel 16Mbps for Impatient Ones