javascript - Get first h1 heading and open \\<server_name>\h1.html in new tab -


i 2 tabs following code - 1 says [object window] , other displays page want.

  1. what rid of first useless tab?

  2. is there way bookmarklet open http:///getting_started_txt_(random_alphanumeric_code_here).html ?.

...i need open page matches h1 part of offline file name file name begins , gibberish.

the offline files @ end "getting_started_txt_23468j5jg86458jm34858.html". bookmarklet must file filename begins "h1 underscores" , after it. possible?

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

so if have page open first heading h1 "getting started", bookmarklet should open new tab url http://(server_name)/getting_started_txt_(random_alphanumeric_code_here).html.

note there 1 file on server matches getting_started_txt part , rest of file name can anything.

something should work in cases.

window.open('\\\\server_name\\en\\' + encodeuricomponent(document.getelementsbytagname('h1')[0].innerhtml.replace(/<[^>]*>/g, '').replace(/\s/g, '_')) + '.html', 'win') 

Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -