PC Review


Reply
Thread Tools Rate Thread

Determine if page is in an iFrame?

 
 
Victor
Guest
Posts: n/a
 
      10th May 2005
Is there any way to test, using JavaScript, VBScript, ASP, or whatever, to
see if the web page displayed is being displayed in an iFrame?




 
Reply With Quote
 
 
 
 
clintonG
Guest
Posts: n/a
 
      10th May 2005
View source.

<%= Clinton Gallagher
METROmilwaukee (sm) "A Regional Information Service"
NET csgallagher AT metromilwaukee.com
URL http://metromilwaukee.com/
URL http://clintongallagher.metromilwaukee.com/


"Victor" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Is there any way to test, using JavaScript, VBScript, ASP, or whatever, to
> see if the web page displayed is being displayed in an iFrame?
>
>
>
>



 
Reply With Quote
 
Steve Easton
Guest
Posts: n/a
 
      10th May 2005
Or right click in the middle of the page and see if the context menu has an option to "Open frame in
new window."

;-)


--
Steve Easton
Microsoft MVP FrontPage
95isalive
This site is best viewed............
........................with a computer

"clintonG" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> View source.
>
> <%= Clinton Gallagher
> METROmilwaukee (sm) "A Regional Information Service"
> NET csgallagher AT metromilwaukee.com
> URL http://metromilwaukee.com/
> URL http://clintongallagher.metromilwaukee.com/
>
>
> "Victor" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
> > Is there any way to test, using JavaScript, VBScript, ASP, or whatever, to
> > see if the web page displayed is being displayed in an iFrame?
> >
> >
> >
> >

>
>



 
Reply With Quote
 
Victor
Guest
Posts: n/a
 
      10th May 2005
Neither one answers my question. But then again, you wouldn't know that,
would you?



"Steve Easton" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Or right click in the middle of the page and see if the context menu has

an option to "Open frame in
> new window."
>
> ;-)
>
>
> --
> Steve Easton
> Microsoft MVP FrontPage
> 95isalive
> This site is best viewed............
> .......................with a computer
>
> "clintonG" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > View source.
> >
> > <%= Clinton Gallagher
> > METROmilwaukee (sm) "A Regional Information Service"
> > NET csgallagher AT metromilwaukee.com
> > URL http://metromilwaukee.com/
> > URL http://clintongallagher.metromilwaukee.com/
> >
> >
> > "Victor" <(E-Mail Removed)> wrote in message
> > news:%(E-Mail Removed)...
> > > Is there any way to test, using JavaScript, VBScript, ASP, or

whatever, to
> > > see if the web page displayed is being displayed in an iFrame?
> > >
> > >
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
Trevor L.
Guest
Posts: n/a
 
      10th May 2005
Do you mean progamatically ?
:-)

--
Cheers,
Trevor L.
Website: http://tandcl.homemail.com.au

Victor wrote:
> Neither one answers my question. But then again, you wouldn't know
> that, would you?
>
>
>
> "Steve Easton" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Or right click in the middle of the page and see if the context menu
>> has an option to "Open frame in new window."
>>
>> ;-)
>>
>>
>> --
>> Steve Easton
>> Microsoft MVP FrontPage
>> 95isalive
>> This site is best viewed............
>> .......................with a computer
>>
>> "clintonG" <(E-Mail Removed)> wrote in
>> message news:(E-Mail Removed)...
>>> View source.
>>>
>>> <%= Clinton Gallagher
>>> METROmilwaukee (sm) "A Regional Information Service"
>>> NET csgallagher AT metromilwaukee.com
>>> URL http://metromilwaukee.com/
>>> URL http://clintongallagher.metromilwaukee.com/
>>>
>>>
>>> "Victor" <(E-Mail Removed)> wrote in message
>>> news:%(E-Mail Removed)...
>>>> Is there any way to test, using JavaScript, VBScript, ASP, or
>>>> whatever, to see if the web page displayed is being displayed in
>>>> an iFrame?



I choose Polesoft Lockspam to fight spam, and you?
http://www.polesoft.com/refer.html


 
Reply With Quote
 
Jon Spivey
Guest
Posts: n/a
 
      10th May 2005
<script type="text/javascript">
if(this.location!=top.location)alert('You've been framed')
</script>


--
Cheers,
Jon
Microsoft MVP

"Victor" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Is there any way to test, using JavaScript, VBScript, ASP, or whatever, to
> see if the web page displayed is being displayed in an iFrame?
>
>
>
>



 
Reply With Quote
 
Mike Mueller
Guest
Posts: n/a
 
      10th May 2005
OK Victor, I'll answer your original question:
:::: Is there any way to test, using JavaScript,
VBScript,
:::: ASP, or whatever, to see if the web page
displayed is
:::: being displayed in an iFrame?


Yes you can do it. You would need to read the source in as
a string and then parse the string to look for the <iframe>
tag.




Victor wrote:
: Neither one answers my question. But then again, you
: wouldn't know that, would you?
:
:
:
: "Steve Easton" <(E-Mail Removed)> wrote in message
: news:(E-Mail Removed)...
:: Or right click in the middle of the page and see if the
:: context menu has an option to "Open frame in new window."
::
:: ;-)
::
::
:: --
:: Steve Easton
:: Microsoft MVP FrontPage
:: 95isalive
:: This site is best viewed............
:: .......................with a computer
::
:: "clintonG"
:: <(E-Mail Removed)> wrote in
:: message news:(E-Mail Removed)...
::: View source.
:::
::: <%= Clinton Gallagher
::: METROmilwaukee (sm) "A Regional Information
::: Service" NET csgallagher AT metromilwaukee.com
::: URL http://metromilwaukee.com/
::: URL http://clintongallagher.metromilwaukee.com/
:::
:::
::: "Victor" <(E-Mail Removed)> wrote in message
::: news:%(E-Mail Removed)...
:::: Is there any way to test, using JavaScript, VBScript,
:::: ASP, or whatever, to see if the web page displayed is
:::: being displayed in an iFrame?


 
Reply With Quote
 
Trevor L.
Guest
Posts: n/a
 
      11th May 2005
I tried this and got an error.

The code should read

<script type="text/javascript">
if(this.location!=top.location)alert('You\'ve been framed')
</script>

Without the escape character (\), the quote(') after "You" is read as the
end of the text for the alert and the rest is then read in as JS and fails

This also works:
<script type="text/javascript">
if(this.location!=top.location)alert("You've been framed")
</script>

--
Cheers,
Trevor L.
Website: http://tandcl.homemail.com.au

Jon Spivey wrote:
> <script type="text/javascript">
> if(this.location!=top.location)alert('You've been framed')
> </script>
>
>
>
> "Victor" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
>> Is there any way to test, using JavaScript, VBScript, ASP, or
>> whatever, to see if the web page displayed is being displayed in an
>> iFrame?



I choose Polesoft Lockspam to fight spam, and you?
http://www.polesoft.com/refer.html


 
Reply With Quote
 
Jon Spivey
Guest
Posts: n/a
 
      11th May 2005
Good catch Trevor :-)

--
Cheers,
Jon
Microsoft MVP

"Trevor L." <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I tried this and got an error.
>
> The code should read
>
> <script type="text/javascript">
> if(this.location!=top.location)alert('You\'ve been framed')
> </script>
>
> Without the escape character (\), the quote(') after "You" is read as the
> end of the text for the alert and the rest is then read in as JS and fails
>
> This also works:
> <script type="text/javascript">
> if(this.location!=top.location)alert("You've been framed")
> </script>
>
> --
> Cheers,
> Trevor L.
> Website: http://tandcl.homemail.com.au
>
> Jon Spivey wrote:
>> <script type="text/javascript">
>> if(this.location!=top.location)alert('You've been framed')
>> </script>
>>
>>
>>
>> "Victor" <(E-Mail Removed)> wrote in message
>> news:%(E-Mail Removed)...
>>> Is there any way to test, using JavaScript, VBScript, ASP, or
>>> whatever, to see if the web page displayed is being displayed in an
>>> iFrame?

>
>
> I choose Polesoft Lockspam to fight spam, and you?
> http://www.polesoft.com/refer.html
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing data to aspx page from htm page via iframe moondaddy Microsoft ASP .NET 4 13th Sep 2007 03:38 AM
How could I add a tooltip to an iframe ? Also, the tooltip contents has to be determine @ run-time ! Radu Microsoft ASP .NET 1 8th Jan 2007 04:11 PM
Using an IFrame On an ASP.NET Page Otis Mukinfus Microsoft ASP .NET 0 5th Dec 2006 08:48 PM
Pass a parameter from one page to the other page with iFrame tag =?Utf-8?B?YmJzYm9i?= Microsoft ASP .NET 2 24th Nov 2006 06:25 PM
Force databinding from an iframe page to the page that contains it? Luis Esteban Valencia Microsoft ASP .NET 0 20th Jan 2005 04:39 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:51 PM.