I am not using any plugins or frameworks.
I have some local help pages (which will not be hosted on a server), most of which need to be loaded into a frame. So, duringonload, I check if the page is in a frame or not:
top.document.location.href == document.location.href
and if this is true, and therefore the page is not in a frame, then I
top.document.location.href = "frame.html?info="+document.location.href;
Now, when frame.html?info=stuff.html loads, I can get the info parameter from:
`top.document` or `window.top.document`
and load that page into a frame as intended.
This all works as intended on Safari, IE9, and Opera. It does not work in Chrome. Instead, top.document and window.top.document are both undefined after frame.html is loaded.
How should I get the top URL and, more importantly, its parameters when I load frame.html?info=...
If it is helpful, I believe this behavior is because of this issue.
Related
On my web page I have multiple frames out of which one frame has following location: /lms/index_lms.html
Now, I want to load present.html file in that frame which is at location: /present.html
I am currently using window.my-frame-id.document.location.href = 'present.html';
This works in IE9, IE10, Chrome and FF but doesn't work in IE11.
In IE11 it tries to search present.html file with following path: /lms/present.html
I can't use document.location.href='/present.html' because, I have few other folder/directories on my webserver before lms folder.
Since this issue happens in IE11 only can any one help me in identifying why this happens. Also, what is the correct way to set present.html page to that frame.
I'm using jQuery $("#my-image").attr("src", "/img/...") (and also .css("background-image", "url()")to show some images. I now discovered that Chrome redownloads the file completely every time the page is loaded or even the js is executed. This shouldn't happen. Why is the cache not used? In Firefox it works like it should. Any ideas?
I have a page that has multiple iframes in it:
parent
|___iframe1
|___iframe2
|___iframe3
iframe1 has a form with some hidden values. I need ( at least ) one of those values on iframe2
Here's my code
<script type="text/javascript">
alert(parent.frames[0].document.getElementById("UserID").value);
</script>
The first time the site loads, this page works fine. I get my testing popup. iframe1 is a bunch of tabs that reload iframe2. When the user ends up navigating back to the tab that includes my script I get a null reference for parent.frames[0].
I'm pulling my hair out trying to fix this and would appreciate any assistance.
I can get this to replicate 100% of the time in Firefox & IE. With Chrome & Safari it's less so. Not in that the value is null less often, but MORE often than not the information is not accessible and I'm just not sure what I'm doing wrong.
Edit for ease of visibility: These frames are ALL on the same domain, same protocol & port.
While I AM implementing the use of easyXDM so that I can pass some data to another site, I have this issue if I include easyXDM or not.
Thanks!
It looks like it's due to the onLoad as suggested by ddr2. If you post this as an answer I'll be happy to flag it as the proper one.
I'm kinda bummed I didn't think of that :(
I've created a bookmarklet as follows:
// Assuming a keyword of 'pin',
// 'pin' will retrieve all bookmarks
// 'pin linux' will retrieve all bookmarks tagged 'linux'
// 'pin linux tools' will retrieve all bookmarks tagged both 'linux' and 'tools'
javascript:params='%s';url='http://pinboard.in/u:xiong.chiamiov';if(params!=''){tags=params.split('%20');for(i=0;i<tags.length;i++){url+='/t:'+tags[i];}}location.href=url;
This works as intended on existing pages. However, when a page doesn't actually exist in the current tab (for instance, about:blank), I get nothing, presumably because document.location doesn't yet exist. open(url) does not work, either.
Is there another way to make this work? I'm using Firefox, if it matters.
You code works on my Firefox - page redirect from about:blank to your webpage(http://pinboard.in/u:xiong.chiamiov/t:%s).
I test document.location from a about:blank page, it works too, please try:
Open a about:blank page in Firefox
run javascript:alert(document.location.href);void(0)
*i think you'd better add void(0) at the end on your code.
I'm currently trying to load a page within a sub-domain, onto my main domain, using an iframe, and have the sub-domain call a javascript function (when dom-ready) within my main domain, so that the main domain can resize the iframe according to the height of the content.
Here's an example
www.mysite.com (code within page):
<script type="text/javascript">
document.domain = "mysite.com";
function doSomething() {
//do something
}
</script>
<iframe id="mytestid" src="test.mysite.com" height="0" width="900"></iframe>
And for my other site, test.mysite.com, here's the code within the page:
<script>
document.domain = "mysite.com";
$(document).ready(function () {
window.parent.doSomething();
});
</script>
This seems to work just fine for firefox, safari, and chrome, but not for IE8.
IE8 always gives me a "permission denied" error when making the call window.parent.doSomething()
I haven't been able to test on IE7 or IE6 to see if the problem persists, but has anyone encountered this problem? Have I missed something with the way I'm laying out the code?
Thanks for the help guys.
document.domain “permission denied” issues with IE8 SOLVED!!
just like other user said, just set a timeout of a couple o seconds after set document.domain where the iframe is on page, and then call your second page within the iframe.
you need to set the SRC value of your iframe, a couple of seconds after you set document.domain on IE8 and it will work..
Here's a thread with a lot of comments about a few possible problems:
http://waelchatila.com/2007/10/31/1193851500000.html
Note that I did not test this, as I don't have IE. Unfortunately, neither seem to convincing from my perspective - try it and see if it works for you.
So, from the above post, it seems there are two possible causes:
The post alleges IE requires all documents to have the same domain. If you have more documents (iframes and such), try removing them and testing with just these two (main and iframe)
See the last comment in the post - it might just be a race condition. Try putting it in a setTimeout with a few seconds of waiting after both pages have set document.domain to the same value
I ran in the same issue and using a timeout didn't solve the issue.
As I had another site with similar settings where all was working fine, I opened both windows side by side and noticed in the status bar at the bottom that one was under "Local Intranet" while the other was under "Trusted Sites".
This led me to another point to check : make sure that both sub-domains appear in the same Security Zone in IE's Internet Security Properties ! If they don't, then you'll have a "Permission denied" error.