I have a webpage that uses frames (yes I know, frames - previously been
flamed about that, but I do not know anything else to use since I am
clueless!!! Been asked to cobble together a site since there is a
misconception that I know what I am doing!!!)
Anyway, one of the things I have been asked to do is create a button
that will allow the user to print the contents of the main window (main
frame) without the navigation bar (header frame) being printed.
Having been looknig into this, I have found the following:
The problem is that the pages spill over to another page (in all printers I've tested - and in a pdf) BUT (and this is weird) if I print the page OUTSIDE of the frames, they print out on one single page as designed. The javascript used to print the page is simple enough:
function printit(){ window.parent.middle.focus(); window.print(); }
...but i don't think the function is the problem.
Does anyone know why a page would print out differently (i.e. longer) if inside a frame in a frameset, why this should be so, and what I can do to prevent the difference and have it print like a normal page?
I have 2 divs in my webpage. One div has links (using anchor tag). When I click on the link, I want the webpage in href url to open in other div. Can I do it using Javascript.
I'm using the following code snippet to show popup menus (in a header frame) and target the menu options to another frame. This works fine for a single hard-coded frame (e.g. "2" below, in doClick) but I need to pass in the target frame ID when the user clicks, the reason being that different options will target different frames depending on who the user is.
the target frame name is in the target attribute of the link tag, i.e. <a href="" target="here"> that the user clicks on but I don't know how to make use of this in the code below. Code:
I have an outer page and an inner iframe. The outer page calculates some javascript, and wants the inner frame to run it. The inner frame should hit a page on the same (private) web server, so this is not a cross-site scripting attack. But I would prefer not to taint the target page with any extra logic to do this. (I will if I must.)
Note that both the outer and inner page have a span with the same ID.
This question will resemble a JavaScript FAQ - how to evaluate Javascript on the fly, or how to reload a JS file. The answers on the web generally do not transport the JS across a frame boundary, so they don't address the bug I encountered, and I can't tell if prototype.js or IE is at fault.
The outer page calls Ajax goodies that generate some JS looking like this:
Element.update("update_me", "here I B");
The page sends that, as a string, into this JS (in application.js):
function update_grinder(sauce) { var grinder = $('grinder');
if (grinder) { var doc = grinder.contentDocument; if (!doc) doc = grinder.document; if (doc) { evaluate(doc, sauce); return; } } document.write("your browser sucks"); }
So that contains enough logic to find the iframe's document, and it works for Firefox, IE, Konqueror, and Opera. The code calls evaluate() with the document where we need the evaluation context, and the string with our source.
Here's evaluate():
function evaluate(doc, sauce) { var s = doc.createElement('script'); //s.defer = true; // <-- no effect s.text = sauce; var body = doc.getElementsByTagName('body').item(0);
if (body) { body.appendChild(s); return; } body = doc.body; if (body) { body.appendChild(s); return; } }
That creates a <scriptblock, sticks our string in as its contents, and pushes the block to the end of our <bodytag. Now here's the bug:
Firefox updates the inner <span id='update_me'>, and IE updates the outer one.
If I remove the outer <span id='update_me'>, then IE simply can't find it and throws an error. Even though it evaluates a script block clearly in the context of the inner iframe.
I have tried calling the script from setTimeout, and from a button's onclick handler.
Is there some script.aculo.us way to fix (yet another) bug in IE? Or is this a bug in prototype.js?
i want to submit form data from the popup window, close the popup, and load in the main window. problem is, it always opens a new 'tab'. i'm using google chrome, i didn't think to try this in
in the <head> of the 'main' window: <script language='javascript' type='text/javascript'> window.name='main'; </script>
However my problem occurs when the user uses the browsers back arrow to return to the previous page, the script executes again returning them once more to the page they have come from. Is anyone aware of a work around to this problem as it would seem there isn't one? perhaps even a better solution for opening the target page from the iframe as top location. This is really causing confusion for users, and I really need to get the issue fixed.
I have a domain: example.com; which is the parent.And a subdomain: api.example.com; which page 'receiver.html' is being loaded in an iframe, child of parent. Both pages set document.domain = example.com.
I'm trying to adapt this code:[url] but Idon't want to load jQuery from the <iframe> again but I need to have the method $.ajax() working from the <iframe> otherwise it would be a cross-domain request and the browser would abort it. I tried ingenuously to set via $('iframe')[0].contentWindow.$.ajax = $.ajax() and I just got a shortcut to the parent page jQuery method. I also tried to "clone" it using $.expand (true...) but the method doesn't work for me; probably because of the complexity of the objected I'm trying to clone. So is there a way for me to use jQuery to have only a $.ajax() method in the <iframe> ? I've thought even about creating a XHR in the child-iframe and then use that in the $.ajaxSetup ({xhr: THATNEWXHR}) but I couldn't do it. I mean, I want to use the XHR factory from jQuery (which has fallbacks for IE, etc) but it has to be created from the iframe-child.
Maybe there is other way to make the AJAX call come from the child-iframe.
If you're wondering "why don't you load jQuery from <script> in the child-iframe", there is a reason... As I'm using jQuery plugins + my own custom javascripts + other independent scripts I created a compiler which minifies each file and bundle them in one. The advantage of this is the reduction of HTTP requests. So "why don't you load that bundle inside the child-iframe?", because it's ugly and Twitter doesn't... Yeah, I like to take Twitter as a reference and I think if they were able to make it so can I;
I got to work in most browsers except IE and Operaby doing it with pure javascript.
I'm "attaching" the code for you guys to test. If you open it with Chrome, Safari or Firefox you will receive 2 alerts one with the return of $.get() and another with the return of a request made via XMLHttpsRequest object. Otherwise (if you open it with IE or Opera) you'll get 'undefined' in the first alert but the real return in the second.
Im trying to make a back button that reloads the previous page the user was at. The back button will be on a small top frame and the page that needs to be controlled will be in the main frame.
The top frame is just a navigation system, and all pages will be loaded in the main frame. Im trying to use this Code:
I want to have a main image in place and when you click on 1 of the 3 frame options the frame changes showing a preview. Also I would like the add to cart button change its code to add the correct item as well.
i need to pass the data in the textfields from the left frame to the textfields in the right frame of my frameset. (ex: dslnum of frame1 will be pass to txtDSLTN of frame2)[URL]
I have two frames (frameset, let's call it frame1 and frame2). Frame1 has links..., and frame2. When some link in frame1 is clicked, it must be changed content of the frame2. Here's example: click. How to do that? (I don't see any javascript code)
I have a parent document that has a frameset with two frames in it. The first frame is a "header" that runs across the top of the site, and never changes. The second frame contains the "content" of the site. Essentially, I am trying to figure out how to prevent the header appearing above external sites when the user clicks an external link in the "content" frame.
Every time the content frame changes to a new URL, I would like the check that URL and determine if the content frame is changing to an external URL (i.e. different domain in URL) or to an internal link (same domain in URL). If the content is changing to an external link, I want to break out of the frame and just load that external link in the top most document.
I would like all of my javascript to be in the parent document, not spread throughout the individual pages of the site. I was trying to approach this by setting the onunload event handler of the content frame, but I am left with a couple of specific questions: 1. In handling an unload event, can you determine the next URL that the document is loading? Code:
I have a little problem, I structure my site with a main page index.html with a frame in the central whit name CENTRALE, so every other page I will open within this frame. Now I need to have a direct link to these internal pages, give an example I wish it were possible to go to the page clothing giving a direct link to that section of the site type www.indirizzo.com / clothing.html because the state of things if I take the 'direct address to that page I open only the part inside of the frame, but I wish I would open inside the "main frame, there is a solution in javascrip to overcome this problem?
I have a frameset with two frames; topFrame and mainFrame. I have code in topFrame and wish to print the contents of mainFrame. The code that I have used has worked for many years and still works on my localhost Apache Server. However, it has now "stopped" working. When I press the button in topFrame it prints the contents of topFrame The code that I am using is
I use dreamweaver mx html editor to make web sites. I think I know enough Html to get by. My new site uses a frame set so the head and controller don't change reload or move. This works nice, now all I have to do to make a new page is make the content page. But my problem is if I send out a link for someone to look at, it only loads the content page and not the frame set. I thought I could use javascript to determine if the frame set is present and if not load it. But I can't seem to find a way to sent variables from one frame to another. Also if a user clicks a link I would like my flash controller to reflect it.
I need to know how to refresh a bottom frame TO a specific dynamic URL from my top frame (meaning the code has to be in the top frame) say every 5 seconds. The top frame will be a php file as I need DB values. But I believe the frame thing is done via javascript. This ain't working so far, it only loads the first URL at not the rest. Is there the ability to refresh to a specific url in a target frame. Code:
One more question about manipulating iframes. In a script I've looked through to investigate AJAX file uploads, there is this technique for accessing the contents of an iframe:
Code: if(frame.contentWindow) { var thebody = frame.contentWindow.document.body; }else if(frame.contentDocument) { var thebody = frame.contentDocument.document.body; }
I haven't been able to find much info on contentWindow and contentDocument. In fact, other sources I've found talk only about using contentWindow to access an iframe's contents, ignoring contentDocument completely. What is the difference between the two, and what browsers is the contentDocument check targeting? Any modern browsers, or is this a backward compatibility thing?
anyway, i have 2 frames. how can i close the top frame from a link within the top frame? i want the lower frame to be the only page displayed but i won't be able to know what the lower frame's url will be.
We have clients asking that we provide an easy way to print envelops from within our web applications. These envelopes need to be pretty advanced, and need to include a bar code and maybe even a logo. My boss wants a solution where we simply "push" the Word or ODF file to the client's computer and it automatically prints on their printer. I actually think that is what our clients are hoping for as well. I've told him I am pretty darn sure that can't be done, because both Word and Open Office files may contain viruses.
My suggestion has been to generate a Word or ODF file that the user can download, open and then print. Alternatively, we could probably generate a PDF to accomplish the same thing. These solutions might involve extra steps, but I know they are possible.
I want to make sure there isn't some other alternative we haven't considered, so I thought I would email this group and see if anyone has some suggestions as to how they would approach this problem.
I have a script for printing the contents of a frame. It works fine but I would like it not only to print the designated frame but to add a header or message at the top or bottom.
I have been pulling out my hair trying to do this.I am printing out the contents of a DIV tag but it does not print the css with it. Just the basic text For example: