Closed Thread Icon

Preserved Topic: Can I capture page title into JS variable? (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=17908" title="Pages that link to Preserved Topic: Can I capture page title into JS variable? (Page 1 of 1)" rel="nofollow" >Preserved Topic: Can I capture page title into JS variable? <span class="small">(Page 1 of 1)</span>\

 
Pugzly
Paranoid (IV) Inmate

From: 127.0.0.1
Insane since: Apr 2000

posted posted 01-06-2001 16:34

Greets!

Trying to do some dynamic mumbo jumbo, and wondering if I can capture the title of the page into a javascript variable? I need to do that for some processing.

Ideas?

Pat Richard
Web weenie
http://www.gurusnetwork.com
ICQ 23113317

mr.maX
Maniac (V) Mad Scientist

From: Belgrade, Serbia
Insane since: Sep 2000

posted posted 01-06-2001 16:52

Pugzly, you haven't said is that JavaScript located on the same page or you want to capture title from some other page... If it's the first case, then solution would be:

var myTitle = document.title;

BTW This works in IE and Mozilla (NS6).



[This message has been edited by mr.maX (edited 01-06-2001).]

Pugzly
Paranoid (IV) Inmate

From: 127.0.0.1
Insane since: Apr 2000

posted posted 01-06-2001 17:27

Actually, for the same page, and I only need it to work in IE anyways. It's for a "click here to add this page to your favorites" type script. It's not visible to NN.

Thanks for the info!

Pat Richard
Web weenie
http://www.gurusnetwork.com
ICQ 23113317

mr.maX
Maniac (V) Mad Scientist

From: Belgrade, Serbia
Insane since: Sep 2000

posted posted 01-06-2001 17:40

Pugzly, you can also add the web site to the Mozilla / Shitscape SideBar...



[This message has been edited by mr.maX (edited 01-06-2001).]

Pugzly
Paranoid (IV) Inmate

From: 127.0.0.1
Insane since: Apr 2000

posted posted 01-06-2001 17:58

Really? do you have an example?

Pat Richard
Web weenie
http://www.gurusnetwork.com
ICQ 23113317

mr.maX
Maniac (V) Mad Scientist

From: Belgrade, Serbia
Insane since: Sep 2000

posted posted 01-06-2001 19:21

Yes, I do! Here we go...

First create a page with content that you would like to show in the SideBar. All links in that page must have TARGET="_content" in order to be showed in the main window. After that add the following JS code to the page where you want to add "Add To My SideBar" button / link:

function addMozillaSideBar() {
if (window.sidebar && window.sidebar.addPanel) {
// parameters: title, content URL, customize URL
window.sidebar.addPanel("My Site","http://www.link.to/content_page_for_SideBar.html","");
} else {
alert("This requires a Mozilla based browser! Visit: http://www.mozilla.org/ for more information.")
}
}

And add a link to the addMozillaSideBar function. That should be all...

---
This "Quick Tip" was brought to you by MAX Interactive corp.

« BackwardsOnwards »

Show Forum Drop Down Menu