Current location: Hot Scripts Forums » General Web Coding » JavaScript » fetching title from another page


fetching title from another page

Reply
  #1 (permalink)  
Old 12-06-03, 09:04 AM
rdnpa rdnpa is offline
New Member
 
Join Date: Dec 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
fetching title from another page

is it possible to fetch the title of another page?

for instance, when the script operates, it will go and get programmingtalk.com's title and write it in my webpage.

if programmingtalk is unavailable, then it will say "website is not available".

is that possible with js?
Reply With Quote
  #2 (permalink)  
Old 12-06-03, 09:22 AM
overule overule is offline
Newbie Coder
 
Join Date: Nov 2003
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
i think it is possible ,there is script that allow fetching whole page of news and there should be no problem regarding title in my opinion

www.hotscripts.com lots of fetching script out there!
__________________
<p><font size="2"><b>http://www.overule.net<br>
<font color="#FF0000">
Web Hosting- Serving At The Best!</font></b></font><b><font color="#FF0000">
<br></font><font size="2">Unlimited features</font>
<br></b><font size="2" color="#FF0000"><b>: :RESELLERS: :SHARED HOSTING: : EMAIL HOSTING: : DESIGN: :</b></font>
Reply With Quote
  #3 (permalink)  
Old 12-14-03, 11:41 AM
psyon psyon is offline
Newbie Coder
 
Join Date: Dec 2003
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
There is no way in only JS to due it, because cross site scripting is not allowed.

You could call a CGI script to be the source of the js, and have it output the script to write it.

On your page you might have
Code:
<script language="javascript" src="/cgi-bin/gettitle.cgi?http://www.domain.com"></script>
Then if this was perl, gettitle.cgi might be
Code:
#!/usr/bin/perl
use LWP::Simple;

print "Content-Type: text/plain\n\n";
my $html = get($ENV{'QUERY_STRING'});
if($html =~ m/<TITLE>(.*?)<\/title>/is) {
  print "document.write('$1');";
} else {
  print "Site not available";
}
exit;
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Only allowing original referrer to access a page fixafone123 PHP 3 05-28-04 04:42 AM
Include makes 2 title tags. Need to pre-delete one at include.. cebuy PHP 4 12-02-03 10:58 AM
echo foriegn html in static page fergusom Everything Java 4 11-10-03 02:35 AM
Parse title & creation date of a page redspider Script Requests 0 10-21-03 03:13 AM
preload an asp page Gurrutello ASP 1 06-24-03 08:12 PM


All times are GMT -5. The time now is 11:31 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.