I get two tabs with the following code - one that says [object Window] and other displays the page I want. 

1. What will get rid of the first useless tab?
2. Is there a way to get the bookmarklet open http:///getting\_started\_txt\_(random\_alphanumeric\_code\_here).html ?.

...I need to open a page that matches just the h1 part of the offline file name with which the file name begins and then some gibberish. 

The offline files at my end are like "getting\_started\_txt\_23468j5jg86458jm34858.html". So the bookmarklet must look for the file where the filename begins with "h1 with underscores" and anything after it. Is this possible?

`window.open('http://en.wikipedia.org/wiki/' + document.getElementsByTagName('h1')[0].innerHTML.replace(/<[^>]+>/g, '').replace(/ /g, '_') + '_txt_');`

So If I have a page open with first heading h1 as "getting started", the bookmarklet should open a new tab with the URL `http://(server_name)/getting_started_txt_(random_alphanumeric_code_here).html`.

Note that there is only one file on the server which matches that getting\_started\_txt part and the rest of the file name can be anything.