Trapping a page in a frame?

S

smerf

Using javascript, is there a way to trap an external page inside a frame?
I've seen scripts to break out of frames, but nothing to keep a page trapped
in a frame.
 
E

Evertjan.

smerf wrote on 21 okt 2006 in comp.lang.javascript:
Using javascript, is there a way to trap an external page inside a
frame? I've seen scripts to break out of frames, but nothing to keep a
page trapped in a frame.

Never looked at MS specs on the web doing that?

<http://msdn.microsoft.com/workshop/author/dhtml/reference/objects/obj_loca
tion.asp>

=====================

possibly:

if (top.location.href == location.href) {
top.location.href =
'http://myDomain.xxx/framespage.html?frame2='+location.href
 
A

ASM

smerf a écrit :
Using javascript, is there a way to trap an external page inside a frame?
I've seen scripts to break out of frames, but nothing to keep a page trapped
in a frame.


it is exacktely same method (or quite)

if(self == top) location='http://mySever/mySite/index';


Or to go back in right place try something like :

if(self == top || (parent.frames && !parent.myFrameToMe)) {
var url = self.location;
setTimeout(function() { parent.myFrameToMe.location=url; },1000);
location = 'http://mySever/mySite/index';
}

and of course you have a frame named 'myFrameToMe' on your main page.

(not tested)


other way (in french) :
http://stephane.moriaux.perso.orange.fr/truc/re_routage_en_frame.htm
 
S

smerf

Will this work for trapping someone else's frames?

Basically I want to make a site like www.torrentscan.com (beware of the
irritating popup) but for educational links. Some of the sites that may be
added will try and break out of the main content frame.

As I understand it, most pages that try and break out of frames do so to
keep others from claiming content as their own (stealing content). Hpwever,
since I am not claiming their content as my own, nor am I altering their
content in any way, I want to be able to force them to stay in a frame next
to my searchbox/sidebar like on www.torrentscan.com (again, beware of the
irritating popup).

There is one other issue that they may have with my links page. If a user
wanted to bookmark their page, doing so from my framed page would not allow
that direct link. I'd like to add an "Add to favorites" button above each
of their pages to allow users to add the framed pages directly to thier
bookmarks/favorites.

Is this a pretty easy thing to do? Should I do it with yet another frame -
just right above the main content frame? And, can javascript read and
manipulate pages in other frames (to get the URL and description) even
though the other frames contain content from other domains?

Thanks soooooo much for your help. I'm new to javascript and trying to
learn all that I can. In fact, any out of the way (i.e. no in the top 50 on
Google) links to good Javascript code/hacks/tutorials would also be
appreciated.

May your camel know the location of every oasis.
 
A

ASM

smerf a écrit :
Will this work for trapping someone else's frames?

Basically I want to make a site like www.torrentscan.com (beware of the
irritating popup) but for educational links. Some of the sites that may be
added will try and break out of the main content frame.

Ha OK, you don't want to see your own pages to do so.
But want these from other sites stop to do it and stay in your frames.

It is very incorrect to show a page from an other site in the window of
your own site.
Hpwever, since I am not claiming their content as my own,

However they *seem to* belong to your site.
Is there a real difference between to copy a page or to capture it ?
Both can be interpreted as stolen.
nor am I altering their content in any way,

Contrefaçon, copy, clone, captured --> all the same : they aren't yours.
I want to be able to force them to stay in a frame next
to my searchbox/sidebar like on www.torrentscan.com (again, beware of the
irritating popup).

I saw no popup (anti-popup in FireFox)
I think all what you see here are pages from torrent (and his associated
sites, probably from same domain) distributed via a google engine.

You probably can find at Google a what engine for free to insert in your
site (for your own pages).
http://www.google.fr/intl/en/searchcode.html

I think to force pages having a javascript to go away from frames to
stay in your frame is not possible.
There is one other issue that they may have with my links page. If a user
wanted to bookmark their page, doing so from my framed page would not allow
that direct link.

Yes it's one of the problems.
I'd like to add an "Add to favorites" button above each
of their pages to allow users to add the framed pages directly to thier
bookmarks/favorites.

That doesn't work if visitor's browser is not IE ...
In your viewer frame you put an onload to call function to add this
button (call will be launched on each new page there displayed).

Code to put in your page of frames :

<script type="text/javascript">
function addFav() {
var b = document.createElement('button');
b.onclick = function() {
window.external.AddFavorite(window.location,document.title); }
var t = document.createTextNode('Add this page to favorites');
b.appendChild(t);
document.body.appendChild(b);
}
Is this a pretty easy thing to do? Should I do it with yet another frame -
just right above the main content frame? And, can javascript read and
manipulate pages in other frames (to get the URL and description) even
though the other frames contain content from other domains?

To get url is not a problem (you have already got it to call the page).
Probably not allowed to get its content (but try it).

So have your button in menu/search frame

<button onclick="var url = parent.viewer.location;
var title = parent.viewer.document.title;
window.external.AddFavorite(url,title);">add to favorites</button>

if 'viewer' above is the name of the frame where are displayed other pages.

And I'm not sure of function about add favorite (I haven't IE Windows).
 
S

smerf

Thanks so much for your help.

It is not my intention that anyone think that I designed these sites or that
they are somehow a creation of mine. (I mean, what if they screw up their
site? I don't want people thinking I code that bad, right?)

I will make sure that my page plainly indicates that the sites linked to are
not mine and are the creation/responsibility of the respsective website
owners.

I have enough trouble keeping my own content straight.

Thanks again!
 
E

Evertjan.

smerf wrote on 22 okt 2006 in comp.lang.javascript:
It is not my intention that anyone think that I designed these sites
or that they are somehow a creation of mine. (I mean, what if they
screw up their site? I don't want people thinking I code that bad,
right?)

I will make sure that my page plainly indicates that the sites linked
to are not mine and are the creation/responsibility of the respsective
website owners.

I have enough trouble keeping my own content straight.

[Please do not toppost on usenet]

Come on.

Why should one infer that your intentions are good,
[because you would not want to be associated with bad code]
if your Q is bad?

You should not use domain-external pages in your frames,
if you are not the owner of both or have permission of the owner,
even if you indicate that.

Use a link.
 
S

smerf

Evertjan. said:
smerf wrote on 22 okt 2006 in comp.lang.javascript:
It is not my intention that anyone think that I designed these sites
or that they are somehow a creation of mine. (I mean, what if they
screw up their site? I don't want people thinking I code that bad,
right?)

I will make sure that my page plainly indicates that the sites linked
to are not mine and are the creation/responsibility of the respsective
website owners.

I have enough trouble keeping my own content straight.

[Please do not toppost on usenet]

The no top posting "rule" is BS. Why would you want toscroll through many
lines of old msgs just to get to the latest reply. If you want to catch up
on the thread, read all of the posts - or scroll down and start at the
bottom.

I wouldn't want to do that, and I won't make others do it either.

Please do not assume the postion of Usenet cop. It's irritating and it does
no good.
Come on.

Why should one infer that your intentions are good,
[because you would not want to be associated with bad code]
if your Q is bad?

You don't have to infer anything. I have stated my purpose. I don't need
to defend it.
You should not use domain-external pages in your frames,
if you are not the owner of both or have permission of the owner,
even if you indicate that.

I humbly disagree.
Use a link.

Not an option.

But, thanks for your opinion though.
 
A

ASM

smerf a écrit :
Evertjan. said:
smerf wrote on 22 okt 2006 in comp.lang.javascript:
[Please do not toppost on usenet]

The no top posting "rule" is BS. Why would you want toscroll through many
lines of old msgs just to get to the latest reply.

- Feel fine, thanks.
- Hello! How are you?

Is it a natural way to present ?
If you want to catch up
on the thread, read all of the posts

It is not quetion to do so.
You have only to report part of precedent text you answer, then to answer.
I humbly disagree.

However it is what I did tell to you.
Exactly same as to insert in a book pages from an other author :
legally you can't do it without his permission.
 
S

smerf

Technically speaking, you can't scan an author's website and post the
results in a search engine without the author's permission either - but who
is suing Google?

ASM said:
smerf a écrit :
Evertjan. said:
smerf wrote on 22 okt 2006 in comp.lang.javascript:
[Please do not toppost on usenet]

The no top posting "rule" is BS. Why would you want toscroll through
many lines of old msgs just to get to the latest reply.

- Feel fine, thanks.
- Hello! How are you?

Is it a natural way to present ?
If you want to catch up on the thread, read all of the posts

It is not quetion to do so.
You have only to report part of precedent text you answer, then to answer.
I humbly disagree.

However it is what I did tell to you.
Exactly same as to insert in a book pages from an other author :
legally you can't do it without his permission.
 
R

Randy Webb

smerf said the following on 10/22/2006 5:55 AM:
Evertjan. said:
[Please do not toppost on usenet]

The no top posting "rule" is BS.

Top-posting is for idiots, take your pick.
Why would you want toscroll through many lines of old msgs
just to get to the latest reply.

It is called trimming and interleaving.

Answer:It destroys the order of the conversation
Question: Why?
Answer: Top-Posting.
Question: Whats the most annoying thing on Usenet?
If you want to catch up on the thread, read all of the posts - or
scroll down and start at the bottom.

Now there is an ingenious idea. If someone wants to know what the
discussion with regards to top-posting is about you are suggesting they
read an entire thread that was started to find out how to steal content
from another site and force it into an IFrame? (BTW, I can tell you how
to do what you want to do).
I wouldn't want to do that, and I won't make others do it either.

Nobody asked you to, they only asked you to use common sense and follow
the practice of others.
Please do not assume the postion of Usenet cop. It's irritating and it does
no good.

Nobody has, but as long as you desire to be confrontational, you won't
get an answer to your question. And the solution is quite simple.
 
A

ASM

smerf a écrit :
Technically speaking, you can't scan an author's website and post the
results in a search engine without the author's permission either - but who
is suing Google?

Google doesn't open foreign pages in its frames, no ?

It does as told besides : a link to the foreign page.

This last method is not in contradiction with copyrights, something like
to talk about a book and to give it's title and/or its author.
 
A

ASM

Randy Webb a écrit :
how to steal content
from another site and force it into an IFrame? (BTW, I can tell you how
to do what you want to do). And the solution is quite simple.

I am interested.

(Because I don't see. Too much simple ?)
 
S

smerf

I don't mean to be confrontational, I had been up for 37 hours working on
this problem and was not at my best.

My apologies to Evertjan.

If top-posting is so bad, why does Outlook Express default to it? Most of
the posts that I read are top posted. If its so bad, why are most posters
that I see doing it?

I guess that I assumed that most people were like me. I don't start in the
middle of a thread. If I am interested in the thread, I read ALL of the
posts, in order. You can't expect to get the whole story otherwise, as
people leave off portions of the conversation as they reply.

When I open a message here, I already am (mentally) at the end of the last
message that I read in the thread. I am ready for a response.....not a
recap.

It simply seems to me that the only people that would have a problem with
top posting are those who (a) can't remember the last time they read
anything in the thread or (b) have a hard time following the evolution of a
topic. They probably would not be able to play chess via snail mail (which
is actually quite a unique experience).

What if people had to replay the whole conversation each time another person
in the conversation responded? That's what the alternative to top-posting
seems like to me.

I post this way to save time.....at least it does for me and I assumed it
did so for everyone else.

Have I assumed too much of humanity yet again - to be able to follow a
conversation without continually re-hashing it over and over again?

Then, there is the fact that the only time I really use USENET over web
resources is as a last resort. When I come here, I have exhausted all other
means of finding the answers which I seek. And, to be honest, it isn't that
often.

In the spirit of USENET, while I am here seeking answers, I visit other
newsgroups (29 not including this one) and answer as many questions as I
can...to give back.

So, is it worth changing USENET clients and fussing over semantics or should
we simply do our best to help anyone in need without succumbing to the
temptation of being judgmental?

I say help each person where they are. I do. Why place requirements on the
conditions in which you will help someone in need? That's just cruel.

And, if I were to change USENET tools, which would I use. All of the ones I
have seen have atrocious interfaces. As a developer/tester of UIs, they
literally make me ill.

As for the original problem, the only solution I can find involves using a
server to harvest the content that is to be displayed and return it to the
browser for display. Unfortunately this is not an option, as the bandwidth
required for such a site would not allow a free and ad-free site as is
desired.

If you do have any suggestions, either for a USENET client shows UI doesn't
suck or on a way to load frame busting pages in IE, Firefox, Opera and
Safari web browser I'd love to hear about them.

And, yes, I know about the IE trick of restricting scripts in iframes, but
that is not cross platform and this solution must work with Safari, Opera,
IE, Firefox and Netscape to reach all of those that wish to use it.

Thanks for your post.

Randy Webb said:
smerf said the following on 10/22/2006 5:55 AM:
Evertjan. said:
[Please do not toppost on usenet]

The no top posting "rule" is BS.

Top-posting is for idiots, take your pick.
Why would you want toscroll through many lines of old msgs just to get to
the latest reply.

It is called trimming and interleaving.

Answer:It destroys the order of the conversation
Question: Why?
Answer: Top-Posting.
Question: Whats the most annoying thing on Usenet?
If you want to catch up on the thread, read all of the posts - or scroll
down and start at the bottom.

Now there is an ingenious idea. If someone wants to know what the
discussion with regards to top-posting is about you are suggesting they
read an entire thread that was started to find out how to steal content
from another site and force it into an IFrame? (BTW, I can tell you how to
do what you want to do).
I wouldn't want to do that, and I won't make others do it either.

Nobody asked you to, they only asked you to use common sense and follow
the practice of others.
Please do not assume the postion of Usenet cop. It's irritating and it
does no good.

Nobody has, but as long as you desire to be confrontational, you won't get
an answer to your question. And the solution is quite simple.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices -
http://www.JavascriptToolbox.com/bestpractices/
 
R

Randy Webb

ASM said the following on 10/22/2006 8:47 PM:
Randy Webb a écrit :

I am interested.

(Because I don't see. Too much simple ?)

Its trivial. All it takes is to think about it calmly and figure out how
it works and how to defeat it. Think simple, don't over complicate it.
 
S

smerf

Now, how does that help?

I am always willing to learn from my errors when they are pointed out. Feel
free to correct anything that I have said here or in the forums.

If not for my edification, at least for the others that may have read my
posts.

You have my undivided attention. Fire when ready.
 
R

Randy Webb

smerf said the following on 10/23/2006 1:13 AM:
Now, how does that help?

I am always willing to learn from my errors when they are pointed out.

Obviously not as you continue to top-post when asked repeatedly not to.
Feel free to correct anything that I have said here or in the forums.
If not for my edification, at least for the others that may have read my
posts.

First, adding any script to check for the parents URL would fail in a
secondary sites pages (it would throw a security error) as it is a
security violation (for the very same reason you can't change the code
in there pages).

Second, if a site doesn't want to be framed (or IFramed) then you have
to accept that. If you don't want to include a link, then don't. How do
you propose to deal with people like me that have IE7 set to open new
links in a new tab? Are you going to try to over ride that choice also?
If the site you are making is free, then make it, enjoy it, and let
other sites work the way they work.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,143
Latest member
DewittMill
Top