Programming Tools
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingProgramming Tools

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old July 18th, 2002, 08:10 PM
Nigorr Nigorr is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: Brisbane, Australia
Posts: 78 Nigorr User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
HTML: Catching a URL

Hi,

I want to catch a url and direct from _top to an iframe.
I need to do this because I am making a site tutorial on how to navigate around the site.

The problem is I don't have access to code to change target or anything like that.

So when a user clicks on a link that looks like the following:
<a href="page.html" target="_top">Link</a>
The page loads up breaking the frames, so i was think of invoking a url catch and redirect with the onUnload event.

I don't know if this is even possible. Once I get the url then I can get it to show in the right spot.

Reply With Quote
  #2  
Old July 19th, 2002, 02:30 AM
mytch mytch is offline
Dev Articles Novice (500 - 999 posts)
 
Join Date: Apr 2002
Location: Sydney, Australia
Posts: 589 mytch User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Hey,
You can just use something like

function catchIt()
{
if(document.frames[0].location.href = 'toppage.html')
document.myiframe.location.href = 'somepage.html';
}

<body onBeforeUnload="catchIt()">

Reply With Quote
  #3  
Old July 21st, 2002, 06:21 PM
Nigorr Nigorr is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: Brisbane, Australia
Posts: 78 Nigorr User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Well there are quite a few urls, and I don't want to hard code these as they can change.

Is there a way to target just urls that go <target="_top">?

I'll try what you suggested and see I can make it work

Reply With Quote
  #4  
Old July 29th, 2002, 10:41 AM
beetle18 beetle18 is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Location: Victoria, TX
Posts: 29 beetle18 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to beetle18 Send a message via AIM to beetle18
You are talking about re-framing and orphaned frame page. I would write the IFRAME object with javascript, so you can then use a variable for the SRC.

I wrote a JS include that handles this sort of thing, you can get it here:
http://www.peterbailey.net/js/superframes.js

The documentation in that file only mentions FRAMESETs, but it can just as easily work for IFRAMEs as well.

Enjoy!

Reply With Quote
  #5  
Old July 29th, 2002, 05:21 PM
Nigorr Nigorr is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: Brisbane, Australia
Posts: 78 Nigorr User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
I can't see how this will help.

You see imagine you are trying to do what hotmail does, when you click on an external link it opens a new window and sticks the site in frames, with your banner up the top and the external site in the bottom frame. Now because the webmaster dosen't like having his site in frames he sticks "target=_top" in all his links because he uses tables instead of frames and this doesn't affect his site, just people who try to stick his site in frames.

What I want to do is somehow intercept this "target=_top" and send the url to my iframe via SRC instead of _top.

Do you see what I'm trying to do now?

Your scripts needs stuff passed to the function, how can I pass stuff to the function if I can't alter the code if I don't have access to it use the function?

So what I'm trying to do is grab the url that the page wants to change to once I know how to do this I'll just use a function like yours and send the url to the iFrame.

Nigorr

Reply With Quote
  #6  
Old July 30th, 2002, 08:46 AM
beetle18 beetle18 is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Location: Victoria, TX
Posts: 29 beetle18 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to beetle18 Send a message via AIM to beetle18
I see. Well, once a link targets the top, any page/code you have will be unloaded. You could use the 'onUnload' method, but it can't be canceled, so that won't help a whole lot either.

the only way I can see you accomplishing this is to open a popup window that monitors the status of the main window, checking to see if the page containing the IFRAME is unloaded, and the reloads it with the requested page as the src.

EDIT: There is another event called 'onBeforeUnload' that operates just like 'onUnload' except that it can be cancelled. However, I'm pretty sure it is proprietary to IE. Of course, all this may be a moot point because I'm not sure how to capture the incoming URL without the window acutally loading it...

Last edited by beetle18 : July 30th, 2002 at 08:52 AM.

Reply With Quote
  #7  
Old July 30th, 2002, 04:50 PM
Nigorr Nigorr is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: Brisbane, Australia
Posts: 78 Nigorr User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Ok, thanks for your help, I'll look into it and post a solution when I get one.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingProgramming Tools > HTML: Catching a URL


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT