Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 7 of 7
  1. #1
    Senior Member Dorky's Avatar
    Join Date
    Jun 2009
    Location
    Destin Florida
    Posts
    1,430
    Member #
    19103
    Liked
    4 times
    i have been disabling right click on iframe links with javascript but i would like to check for parent and load it if it is not present. any suggestions. this is for my site www.studio378d.com . for now i have removed the javascript that disables the right click, im trying to do away with any javascript by the way.

    while($get_it !== true){ continue; }

  2.  

  3. #2
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,715
    Member #
    5580
    Liked
    717 times
    I don't understand what "check for parent" means.
    By disabling right-click, what purpose was the for?
    I don't see any images that I can't already copy.


  4. #3
    Senior Member Dorky's Avatar
    Join Date
    Jun 2009
    Location
    Destin Florida
    Posts
    1,430
    Member #
    19103
    Liked
    4 times
    lol no im not protecting anything. if you right click and select open in new window you get just the contents of the iframe without the parent page that contains th iframe. thus far i have used javascript to disable right click but thats not exactly cool. i was wondering if there was another way to check for the parent page when the iframe content loads and gives a message instead of the contents if the parent is not present. yes i could use a dynamic div but the effect in a few minor areas is not desireable, like refreshing the parent page for this just looks dumb and takes longer to load then just loading the contents is just one example of why i dont want to use dynamic divs for this.

    while($get_it !== true){ continue; }

  5. #4
    Junior Member
    Join Date
    Dec 2009
    Posts
    2
    Member #
    20626
    An alternative method is to use CSS with a transparent image. It works like this:

    01. Determine the size and position of your <iframe>

    02. Create a <div> which covers the area of the iframe
    - position: set left, height, top and width attributes as appropriate
    - z-index: some number higher than the z-index for the iframe
    - background: url(/path/image.gif)

    The default is for the transparent image to be positioned at the top left of the <div> and to be repeated along the x and y axes so that it covers the whole area of the <div>. If this is not your default behaviour (perhaps because of some other style setting) then you will have to set background-repeat explicitly.

    The practical effect of this solution is that your <iframe> can be seen but none of the content is clickable because the <div> with a background image has a higher z-index value than the <iframe>.

    If you have scrollbars enabled, remember to set the <div> width and height attributes so that you can still get at the scrollbars!

    To create a transparent gif file (assuming you are running Windows), open Paint and create a single colour image. It does not need to be very large. Save it as a .gif file then open an image editor such as myimager.com, upload the file and select the transparency option. (In myimager.com, this can be found under Adjust -> Transparent.

    Save the now transparent file in an appropriate folder on your webserver and reference it in your <div> attributes.

  6. #5
    Senior Member Dorky's Avatar
    Join Date
    Jun 2009
    Location
    Destin Florida
    Posts
    1,430
    Member #
    19103
    Liked
    4 times
    way over complicated. you dont even need an image to do this, just a transparent div, and im not sure how thats going to stop anyone from right clicking the link and selecting "open in new...". thx tho.


    Quote Originally Posted by thomasm1964
    An alternative method is to use CSS with a transparent image. It works like this:

    01. Determine the size and position of your <iframe>

    02. Create a <div> which covers the area of the iframe
    - position: set left, height, top and width attributes as appropriate
    - z-index: some number higher than the z-index for the iframe
    - background: url(/path/image.gif)

    The default is for the transparent image to be positioned at the top left of the <div> and to be repeated along the x and y axes so that it covers the whole area of the <div>. If this is not your default behaviour (perhaps because of some other style setting) then you will have to set background-repeat explicitly.

    The practical effect of this solution is that your <iframe> can be seen but none of the content is clickable because the <div> with a background image has a higher z-index value than the <iframe>.

    If you have scrollbars enabled, remember to set the <div> width and height attributes so that you can still get at the scrollbars!

    To create a transparent gif file (assuming you are running Windows), open Paint and create a single colour image. It does not need to be very large. Save it as a .gif file then open an image editor such as myimager.com, upload the file and select the transparency option. (In myimager.com, this can be found under Adjust -> Transparent.

    Save the now transparent file in an appropriate folder on your webserver and reference it in your <div> attributes.
    people still use windows? lmao

    while($get_it !== true){ continue; }

  7. #6
    Junior Member
    Join Date
    Dec 2009
    Posts
    2
    Member #
    20626
    I couldn't make a transparent <div> work consistently - it does for some browsers but not for others.

    If you use a background image, right-clicking brings up the 'Save Picture' context menu rather than the 'Open in new window' menu.

  8. #7
    Senior Member Dorky's Avatar
    Join Date
    Jun 2009
    Location
    Destin Florida
    Posts
    1,430
    Member #
    19103
    Liked
    4 times
    Quote Originally Posted by thomasm1964
    I couldn't make a transparent <div> work consistently - it does for some browsers but not for others.

    If you use a background image, right-clicking brings up the 'Save Picture' context menu rather than the 'Open in new window' menu.
    you dont have to make it transparent, just fill the hole and leave the div empty. no img not opacity/bg nothing. just use absolute w/h 100% and z-index

    while($get_it !== true){ continue; }


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Search tags for this page

blank image over page to disable iframe link

,
check right clich on hyperlinks javascript
,
disable right click for a link in iframe
,
right click open in new window iframe
Click on a term to search for related topics.
All times are GMT -6. The time now is 05:35 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com