How To Prevent JavaScript From Executing In An Iframe
Aug 31, 2005
Is there some way from preventing the JavaScript code in a document loaded into an iframe from executing? I don't have access to the pages being loaded into the i-frame so I can't modify then. They are being loaded from a server.
I have a select dropdown and 5 text fields. based on the option selected (which are the units - cm/mm/inches/ft/yard etc), i change the values in the text fields using javascript to the corresponding units.
my problem is that when the options are selected very quickly(for eg using the keyboard's up/down keys) then quickly, the text field values lose their connection with the select box and the values become illegal.
I suspect that the javascript function is being called even before the earlier execution has not terminated. I tried using a global variable and using it as a lock, but still no success.
I'm using mooflow code on my website, problem is that it shows images on top of one another, before script arranges them to row. This only happens with explorer.
You can see example of the images popping up (and scroll bar flashing on the side of the page), when this page is loading on explorer, [URL]
Could there be some solution for the explorer so it wouldn't load images before executing the script? Other browsers work better with the loading order.
I am using an ASP.NET AJAX control (ValidatorCallout) that requires client-side validation to work with a custom validator I added. This is an example of some code that works:
ClientValidationFunction="CheckPrime" ControlToValidate="PartNumberText" ErrorMessage="b><br />A Part Number is required."></asp:CustomValidator> <script language="JavaScript"> <!-- function CheckPrime(sender, args) { var iPrime = parseInt(args.Value); var iSqrt = parseInt(Math.sqrt(iPrime));
for (var iLoop=2; iLoop<=iSqrt; iLoop++) if (iPrime % iLoop == 0) { args.IsValid = false; return; }
args.IsValid = true; }
This is code I borrowed from another site to test this method - and it works. My problem is that I need the JS to execute a VB function in my project and I don't know how to do that. I want to do something like:
function CheckValue(sender, args) { var sPartnumber = String(args.Value); if FindExistingPN(sPartNumber) { args.IsValid = false; return; } args.IsValid = true; }
....where FindExistingPN is a funciton in my VB class. I have seen some other posts about this, but none of them really gave me any sample code that I could run. As I mentioned earlier, my JS skills are lacking, so I am unable to create this myself.
I'm trying to execute a bat file on the server in javascript. The javascript sits on the server as well. I'm currently using:
document.location.href='testme.bat'
However the only thing it does is just opens up the bat file and shows my bat code in the browser. How can I execute the batch file instead of opening it and viewing it in the browser?
I'm working on a site that uses an iframe to load cross domain sites.The problem is that some sites use javascript to say put focus into an input field.I have managed to prevent this by using setInterval that continuously gives focus to an input on my page but this causes the problem of not being able to click into the location bar.So basically, is it possible to to only regain focus when an element inside of the iframe takes focus? Or even just solving the location bar problem with my current solution would also work. (And I have tried things such as applying onfocus events to the iframe element - but they simply don't work because it's not the iframe that's gaining focus, but elements inside of it)
somewhere in my JavaScript code in the page, I set the src attribute of the ifrmae. This causes the iframe to load the page as it should.
If I leave this page to another and click 'back' in the browser, I return to my page, and the iframe gets loaded automatically, using the last src value it had.
I don't want that. I only want the iframe to load when my JavaScript code modifies the src attribute.
It is as if the browser remembers in its cache the last value of the iframe src.
For some god-forsaken reason (which I can't find out either) MSIE stopped executing any JavaScripts. In any page which contains JavaScript code, that code won't be executed. There are no error messages, no warnings, nothing. It simply does'nt work. I'm pretty sure this could be caused by some stupid installation of another program that messed up some IE settings.
Security settings for IE are all lowered down. Everything is activated (Scripts, ActiveX, automatic download of anything, anytime)... so we ran out of ideas of what could be the problem. And yes, we have also tried to reinstall IE.
The only clue we have is that a local Administrator user can change IT security settings for himself and (go figure) things work fine! The problem occurs with users that have limted access to the computer and I am pretty sure this shouldn't happen. If you are wondering... yes... the local administrator has already tried to change the settings for limited user account..
What I am trying to do is dynamically update an image and image map on a page. I'd like the update to happen as quickly as possible and be done without refreshing the page. The catch is that the image map uses the wz_tooltip.js (http://www.walterzorn.com/tooltip/tooltip_e.htm) library to display a JavaScript tooltip containing detailed information about different areas of the image. So, when I pass the required <script> tags via .innerHTML, the browser treats it as text and does not interpret the JavaScript and execute the code.
if i try iframe'ing this site [URL] it doesn't work :( , it automatically redirects the site to the parent window. this may be due to the some script code in that site :confused: ...
I have a frame breaker script that is used on a site that I maintain. The problem is I need to implement a tracking tag from a 3rd party vendor that requires their tag to be in an <IFRAME>.
Unfortunately this causes an infinite loop/refresh on the site. How can I make sure that the site is broken out of frames but that the iframe coded on the site does not try to break out of itself? Code:
Basically, I have a page that I load with 10 input fields. If users have JS enabled I want to hide 5 of these fields so as to reduce clutter. If the user needs these extra fields an "Add" button can be used to display the hidden fields one by one.
Once the fields a filled in the user submits them for validation and if there are any error They can "Go back" to make some changes. The whole process works great in FF & Opera but IE lets me down because if you use the Browser "Back" button the Javavscript gets executed even though it should be loaded out of cache.
I'm currently using this method to refer to my JavaScript files:
<script type="text/javascript" src="filename.js"></script> While doing work for some clients I have made changes to the the JavaScript file referenced above. Because their browser has cached it, they end up getting errors on the page unless they hard refresh and get the new version of the file.
Is there anyway to make the JavaScript file come down fresh if it has been modified since the last download?
I am working on some JavaScript, that amongst other things does searches in an index. The search can take a couple of seconds, and I would like to disable the form button that the user clicked to trigger the search. In addition I would like an animated GIF to appear, visualizing that a search process is ongoing.
My problem is: While the procedure that implements the search is executed, the browser window is not refreshed. The button stays in "down" mode, the gif freezes.
Is there some command I could insert in between my code statements that lets the browser refresh it's window's contents?
Here's the thing, I'm using the iframe as a "browser" within the page on top of the iFrame I've got an input box that I want to use as the address bar
so I did some reading and I can see it's not possible due to security issues, because they're different domains.
but maybe there's a way to get the URL through server side, an xmlhttprequest perhaps?
the only person that's ever going to use this is me, and only on my home PC maybe there's a way to change the browser security settings to make this work? (running Firefox 1.5)
here's the code I'm using that's obviously not working
Code:
var url=document.getElementById('preview').src; document.getElementById('addressBar').value=url;
I have a page with an iframe. On the main page I have a form. Now I want this form to on submit, execute something on the iframe (refresh). However I have different can have different iframe pages. What I need is a way figure out the name or file name of the page inside the iframe and then refresh that page. So it looks something like this:
I want to know the recommended way to handle scripting of/with containers such as an iframe. I have a page with border-navigation bars on the top/bottom/left/right and I want to use an iframe to load content in the middle.
I would like, if possible, to have the parent window resize itself to suit whatever is loaded into the iframe container, deriving the size needed from calculated values. Thus the calculation would have to over-ride default and/or previous settings for the size of the initial iframe after all of the associated container content has been fully loaded and rendered....
I have a web application interacted with through my site via an iframe. The web app displays maps and other info. When i try to load it in the iframe to view the map i get this javascript error: "'parent.mapframe' is null or not an object"
Is this because it is seeing the iframe as the parent frame? Is there anything i can do to get round this?
Is there a way to change an iframe's src with a javascript? I need to have an iframe on my webpage display different data based on which link is clicked. I don't want to have it reload the whole page, just the iframe.
How do you turn an iframe scrollbar off, from within javascript, after the iframe has been loaded? In my example, the page with the iframe on it is initially set to scrolling=yes, however, I want to be able to set the scrollbar=no, through javascript.
What I get in IE is the "YO!" written to the iframe. What I get in Firefox is the 404 not found page of the site where the original "jstest.html" page and script are hosted.