473,545 Members | 289 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Trapping a page in a frame?

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.
Oct 21 '06 #1
42 3817
smerf wrote on 21 okt 2006 in comp.lang.javas cript:
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/a...jects/obj_loca
tion.asp>

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

possibly:

if (top.location.h ref == location.href) {
top.location.hr ef =
'http://myDomain.xxx/framespage.html ?frame2='+locat ion.href

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Oct 21 '06 #2
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.myFrame ToMe)) {
var url = self.location;
setTimeout(func tion() { parent.myFrameT oMe.location=ur l; },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...e_en_frame.htm

--
ASM
Oct 21 '06 #3
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.

"ASM" <st************ *********@wanad oo.fr.invalidwr ote in message
news:45******** *************** @news.orange.fr ...
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.myFrame ToMe)) {
var url = self.location;
setTimeout(func tion() { parent.myFrameT oMe.location=ur l; },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...e_en_frame.htm

--
ASM

Oct 21 '06 #4
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.create Element('button ');
b.onclick = function() {
window.external .AddFavorite(wi ndow.location,d ocument.title); }
var t = document.create TextNode('Add this page to favorites');
b.appendChild(t );
document.body.a ppendChild(b);
}
</script>
<frame name="viewer" onload="addFav( );" ...
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.l ocation;
var title = parent.viewer.d ocument.title;
window.external .AddFavorite(ur l,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).

--
ASM
Oct 21 '06 #5
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!

"ASM" <st************ *********@wanad oo.fr.invalidwr ote in message
news:45******** **************@ news.orange.fr. ..
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.create Element('button ');
b.onclick = function() {
window.external .AddFavorite(wi ndow.location,d ocument.title); }
var t = document.create TextNode('Add this page to favorites');
b.appendChild(t );
document.body.a ppendChild(b);
}
</script>
<frame name="viewer" onload="addFav( );" ...
>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.l ocation;
var title = parent.viewer.d ocument.title;
window.external .AddFavorite(ur l,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).

--
ASM

Oct 21 '06 #6
smerf wrote on 22 okt 2006 in comp.lang.javas cript:
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.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Oct 22 '06 #7

"Evertjan." <ex************ **@interxnl.net wrote in message
news:Xn******** ************@19 4.109.133.242.. .
smerf wrote on 22 okt 2006 in comp.lang.javas cript:
>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.

Oct 22 '06 #8
ASM
smerf a écrit :
"Evertjan." <ex************ **@interxnl.net wrote in message
news:Xn******** ************@19 4.109.133.242.. .
>smerf wrote on 22 okt 2006 in comp.lang.javas cript:
[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.
>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.
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.
--
ASM
Oct 22 '06 #9
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" <st************ *********@wanad oo.fr.invalidwr ote in message
news:45******** *************** @news.orange.fr ...
smerf a écrit :
>"Evertjan." <ex************ **@interxnl.net wrote in message
news:Xn******* *************@1 94.109.133.242. ..
>>smerf wrote on 22 okt 2006 in comp.lang.javas cript:
[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.
>>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.

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.
--
ASM

Oct 22 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2947
by: Wugi | last post by:
I'm trying to find an equivalent of key-event trapping which is easy in QBasic. Several of my programs build up a geometric figure with two parameter line families, eg with two nested for..next loops; after that, the process is redone, or moves on to a new position of the same figure. With a slow system each build-up may take some time. But...
1
2467
by: Bart Plessers \(artabel\) | last post by:
Hello, I am wondering if one could do following. I have a main frame with 3 subframes ("top", "left" and "contents") I have a link in the left frame, someting like: <a href="test.asp?Mypath=/multimedia/images/">images</a> When clicking the link in the left frame, the page "test.asp" is displayed in the "contents" frame, with parameter...
5
2413
by: Dan | last post by:
We have a simple site. It's a frameset with two frames a left and a right. The left frame is essentially a list of records from a database (using a server-side repeater control). When you click on one of the items in the left frame, it targets the right frame and displays a form prefilled with information for the item you clicked. The...
3
5864
by: =B= | last post by:
Hi all, I was wondering if anyone has had any luck with trapping the <BODY> onUnload() event in ASP.NET? The thing is, I'm writing code for an Intranet site. The code makes a call to a third-party component (think of it as a lock) when the page loads. Now the OK and Cancel server buttons I can handle and use to release the lock as...
2
3863
by: Captain Nemo | last post by:
I'm still using Office 2000 myself, but some of my clients have Office 2003. I've recently added a piece of code to create an instance of Word, open a document, fill in the blanks and become visible so the document can be printed and/or modified. This all takes place within one form, in which the Word.Application and Word.Document objects...
9
2096
by: 47computers | last post by:
Pretty new to PHP, I recently started learning about error trapping. As of right now, I include the following into a page in my website: -------BEGIN PASTE-------- error_reporting(E_ERROR | E_PARSE); set_error_handler("SendErrorReport"); function SendErrorReport($errorNumber, $errorMessage, $errorFile, $errorLine, $vars) {
0
7465
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7398
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7805
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7416
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7752
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5969
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3449
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3441
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1878
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.