I have a variable
var s="<p>long content.....</p><p>long content....</p>"
I put this inside a iframe by
$('#iframeid').contents().find('html').html(s);
And I set the translateX of iframeid dynamically based on the browser size. So when the browser is big both the paragraph are shown. And when the browser is small first paragraph is displayed on the browser.
Now when the browser is small I use
document.getElementById('iframeid').contentWindow.document.body.innerText
And I get "long content....." and when I use
document.getElementById('iframeid').contentWindow.document.body.innerHTML
I am getting the variable s value completely. I want to get only the html content of the displayed position
Any help is appreciated. Thanks in advance.
I think that it isn't possible...
I can only suggest to you something that can give you something to getting started on it.
Jquery, on a big HTML with scroll, how to capture only the visible part of the HTML?
or you can use this plug-in:
jQuery.fracs, see the demo: demo
Probably if you want to show a portion of HTML and get only this visible part you must think up something and probably you can't use iFrame.
Related
I was doing an innerHTML on a div element. MY lead comes and tells me that innerHTML and iFrame are both the same. Now this one was something new. I always thought InnerHTML to be different from iFrame.
[My lead]: "The issue is because he is trying to use innerHTML which
in turn is called as IFRAME for a browser"
I wanted to know the differences between an iFrame and innerHTML. Are they both essentially similar in nature? I looked but couldn't find much.
Thanks
Sounds like a communication error--e.g., if your lead means that the innerHTML of that div is just going to show an iframe as its innerHTML (or otherwise, it would sound like you need a new lead). innerHTML grabs the HTML code as a string inside of the selected element. An iframe is an element used for transcluding content (usually from other sites or other pages on your own site). Apples and oranges...
They're very different. An iframe tells the browser to load a different URL in the iframe, and it will often have it's own scrolls. But a div can be made to look and work like an iframe by setting
overflow: auto
- in the style. Maybe that's what he meant.
iframe is an HTML tag used for displaying another website or page on your page, innerHTML is used in Javascript to change the content of an element on your webpage.
They are completely different.
They are not the same. Innerhtml is a way to access the contained html of an html element. An iframe is an element that let's you display content from a different web page than the one you're currently on.
im new to javascript and jQuery in general,
I have a html openened in Shadowbox with something like
Argentina
Inside that html i have a link to another html that i want to display in the same shadowbox, but it's size is bigger.
How could i resize the shadowbox so that the second html it's not cutted off?
I've read something about
function openSB(path,width,height){
but i dont know how to make it work
Thanks
http://www.victorstanciu.ro/dynamically-resizing-the-shadowbox-js-modal-window/
"The reason you might want to manually resize the modal window is in case the content inside changes, for example in the case of IFrames. Fortunately, implementing such a method is quite easy."
You don't say what version you're using, but a comment on that page offers a solution for version 3 also: http://codestory.a-chantioux.fr/dynamic-resize-with-shadowbox-js/
Hi I've wrote simple Safari extension to display QR code with url to currently visiting website..This is part of code where I am appending the code to page..
document.body.insertBefore(qrdisplay, document.body.firstChild);
qrdisplay.appendChild(img);
All is wokring, but what sucks is, the code appends too to an iframe content..Actually nasty problem if every site contains facebook like box and lot of other crap:D Can I somehow append the element only to main body?When I would use some kind of "body child of body" selector it wouldnt work..It simply cant as there are two independent DOMs?Am I right?
Thanks for your advice, I hope you understand to my problem..
I think you need to check if window === window.top before running your appending code.
To make things easy, here's the site - http://schnell.dreamhosters.com/folio/pixelread.php View the source code all you like.
The middle button of the top bar in your browser window that says "Palette" is supposed to open up a fancybox in the middle of the screen, and that box should load into it the data inside the element with id of 'data', but it doesn't and comes up with an error message of "The requested content cannot be loaded. Please try again later." I took this example straight from the fancybox website and double-checked that all the CSS, image and JS files are in their proper place and loaded. So now I'm lost and no idea how to do/fix this.
PS - I use Google Chrome 6.0. I'll see if this happens in IE8 or Firefox.
PPS - Found a solution. I can force the HTML content that goes into a fancybox by using the 'content' property. Using that and jQuery I can easily stuff a box with whatever I want. Thanks for the help guys.
Found a solution. I can force the HTML content that goes into a fancybox by using the 'content' property. Using that and jQuery I can easily stuff a box with whatever I want. Thanks for the help guys.
I think the problem is that fancybox isn't recognizing your content as being inline (not exactly sure why, but maybe something to do with the query string in the url, since it works when that isn't present).
I would try adding the explicit type: inline to your fancybox declaration:
$("a#inline").fancybox({'type':'inline'});
I was able to get a full page loaded into an iframe but I want a certain part of the page. I know the div id of what I need. This is my current code
onload=function(){
var el=document.getElementById("frameContainer")
el.innerHTML = "<iframe src=\"url\"></iframe>"
}
I was thinking of getting the full page and then grabbing the div from there and displaying it but I couldn't figure out how.
Any suggestions?
cross-domain issues are likely to foil you. consider some sort of server-side/curl-ish solution instead?