Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8122335
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T05:48:17+00:00 2026-06-06T05:48:17+00:00

I have applied this code for iframe id. <iframe id='<?php echo ‘fraDisabled’.$i.$post->ID; ?>’ src='<?php

  • 0

I have applied this code for iframe id.

 <iframe id='<?php echo 'fraDisabled'.$i.$post->ID; ?>' src='<?php echo $file['url']; ?>'  ></iframe >


function disableContextMenu()
{

  var text="you dont have proper privelages to do this !!";
  window.frames['<?php echo 'fraDisabled'.$i.$post->ID; ?>'].document.oncontextmenu = function(){alert(text); return false;};
  window.frames['<?php echo 'fraDisabled'.$i.$post->ID; ?>'].document.onkeypress = function(){alert(text); return false;}; 
  window.frames['<?php echo 'fraDisabled'.$i.$post->ID; ?>'].document.onmousedown = function(){alert(text); return false;}; 
}

PHP:

<iframe id='<?php echo 'fraDisabled'.$i.$post->ID; ?>' src='<?php echo $file['url']; ?>'>
</iframe>

It works in Chrome but it is not working in Mozilla Firefox.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T05:48:19+00:00Added an answer on June 6, 2026 at 5:48 am

    Probably won’t help that you have an apostrophe ' in your text variable.

    Change…

    var text='sorry you don't have permission to do this !!';
    

    To…

    var text='sorry you don\'t have permission to do this !!';
    

    Or…

    var text="sorry you don't have permission to do this !!";
    

    ADDITIONAL

    You also need to change the ''id'' in the last 2 lines to just 'id'

    UPDATE

    Looks like an issue with Firefox and the use of windows.frames['id'] when the frame only has an id.

    Try adding the dynamic id you’re generating to both the id and name attributes on the <iframe>.

    YET ANOTHER PIECE OF INFORMATION HAS COME TO LIGHT

    I’ve just discovered that the <iframe> in question will contain a PDF document.

    It would appear that Chrome will fire the click and context menu events as the OP is expecting… but IE and Firefox do not, which is more the behaviour I would expect.

    Unfortunately I do not believe there is anything you can do about it. And from a usability point of view, you are also making it impossible to scroll on the PDF using the scroll bar (mouse wheel would still work though).

    I still believe that the name attribute is required in FireFox for the window.frames reference though.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a youtube video embed code that looks like this: <iframe width=560 height=315
I have this code,everything works fine but .css('color','red') rule is not getting applied.I tried
I have this code : <script type=text/javascript> $(document).ready(function() { $('.classSelect').change(function() { // somethings });
I have this code, but the style is not being applied. I've seen articles
I have here this code. I want it to first display an image file
I have this code applied to a input test type onClick=this.value+='http://' , but I
I have some php code which works to chek the incoming url and i
I have this method which does certain checks and applies a color code on
Here is a jQuery slide function I have applied to a div on hover
I am fairly new to PHP, but have applied my previous knowledge of programming,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.