473,544 Members | 1,767 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

cross frame scripting

<html>
<head>
<title>Cross Frame Reference</title>
<script language="javas cript">
function showThisTitle() {
alert(document. title);
}
function showAnotherTitl e() {
try {
alert(anotherWo rld.document.ti tle);
}
catch (e) {
alert(e);
}
}
</script>
</head>
<body>
<iframe width="100%" height="50%" name="anotherWo rld"
src="http://www.google.co.k r/"></iframe><br><br>
<div align="center">
<input type="button" value="Show this title"
onClick="showTh isTitle();">
<input type="button" value="Show iframe's title"
onClick="showAn otherTitle();">
</div>
</body>
</html>

in the code above, i cannot get the document title of iframe.
i have understood it was because of security problem.

how can i get the title, (location.)href or (domain.)url of iframe
beyond security problem?

Dec 26 '05 #1
3 10189
You can't :), mozilla points out to using a signed script, meaning, a
script with some certificate to disable the security, coming from the
domain loaded in the frame, but all that's on the server, not client.

Danny
Dec 26 '05 #2
On 2005-12-26, Vongza <pa****@gmail.c om> wrote:

in the code above, i cannot get the document title of iframe.
i have understood it was because of security problem.

how can i get the title, (location.)href or (domain.)url of iframe
beyond security problem?


serve its content from the same server as the main document.

--

Bye.
Jasen
Dec 26 '05 #3


Vongza wrote:

<iframe width="100%" height="50%" name="anotherWo rld"
src="http://www.google.co.k r/"></iframe> how can i get the title, (location.)href or (domain.)url of iframe
beyond security problem?


If the iframe contains a document loaded from the same origin as the
parent document then script in the parent document can access
window.frames.a notherWorld.loc ation.href
window.frames.a notherWorld.loc ation.host
window.frames.a notherWorld.doc ument.title

I am not sure what "beyond security problem" means, if you are looking
for ways to script such a document on a remote host with script from
your own document then on Windows instead of IE you could use HTA, HTML
applications as there your script is not subjected to the same origin
policy. Or you could write a Windows Script Host script to automate an
IE browser window into which you load that URL, that way your Windows
Script Host script has access to the objects IE exposes for the document.
With Mozilla/Netscape you don't need an HTA but could write your own
local HTML document referencing that external frame document and then
your script in the local HTML document is able to request privileges to
do stuff normally not allowed, e.g. access that frame. But that will
only work if your own HTML document is being loaded locally and the
browser users then in a dialog grants the script the privilege. If you
have a document on a HTTP server then you need signed script.
Here is an example, if you load that from the local file system in
Mozilla or Firefox then every time a document has been loaded in the
iframe the script requests the UniversalBrowse rRead privilege for cross
domain scripting, so the browser will fire up a dialog asking the user
to grant or deny the privilege and if granted the script access the
iframe and its document:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>requesti ng privilege in Mozilla</title>
<script type="text/javascript">
function output (text, tagName, parentNode) {
tagName = tagName || 'p';
parentNode = parentNode || document.body;
var doc = parentNode.owne rDocument;
var element = doc.createEleme nt(tagName);
element.appendC hild(doc.create TextNode(text)) ;
parentNode.appe ndChild(element );
}

function privilegeTest () {
if (typeof netscape != 'undefined' &&
typeof netscape.securi ty != 'undefined' &&
typeof netscape.securi ty.PrivilegeMan ager != 'undefined' &&
typeof netscape.securi ty.PrivilegeMan ager.enablePriv ilege !=
'undefined')
{
try {

netscape.securi ty.PrivilegeMan ager.enablePriv ilege('Universa lBrowserRead');
try {
var frame = window.frames.r emoteFrame;
output('locatio n.href: ' + frame.location. href);
output('locatio n.host: ' + frame.location. host);
output('title: ' + frame.document. title);
var p = frame.document. getElementsByTa gName('p')[0];
if (p != null) {
p.appendChild(p .ownerDocument. createTextNode(
' Kibology for all. '));
}
}
catch (e1) {
output('Error ' + e.message);
}
}
catch (e) {
output('Privile ge not granted: ' + (typeof e == 'string' ? e :
e.message));
}
}
}
</script>
</head>
<body>

<h1>privilege test</h1>

<div>
<iframe name="remoteFra me"
width="100%"
height="400"
onload="privile geTest();"
src="http://www.mozilla.com/"></iframe>
</div>
</body>
</html>

--

Martin Honnen
http://JavaScript.FAQTs.com/
Dec 26 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
4355
by: Charles Crume | last post by:
Hello; My index.htm page (www.charlescrumesoftware.com for those interested in looking) contains 3 frames (left = content, top right = logo, bottom right = navigation). This domain name is registered with www.mydomain.com and is stealth forwarded to www.ccthecomputerguy.com (where my *real* web site currently lives). FWIW, I do this because...
6
9538
by: NoCopy na | last post by:
Using the following example: domiframetest.html <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>DOM Iframe Test</title>
7
3896
by: Scott M. | last post by:
How can I disable the cross-site scripting check for one particular page of a site?
4
2942
by: taoberly | last post by:
Hello, Is it possible to run an HTML file from "localhost" and bypass the various security checks in place for cross-frame scripting? For example, on a 2-frame page loaded locally: a) frame 1 includes a form that accepts the name of a web site (example: www.foo.com), which a script or perhaps a "target" attribute then loads into frame 2...
1
2989
by: WT | last post by:
Hello, I have an asp.net 1.1 application that runs an asp.net 2.0 page in an iframe. I need to save the contained app before saving the main one when the save button is clicked. For this I uses a jscript on the main page that calls a jscript method on the contained one. As my applications are running on differents servers, ie domains, I...
11
4249
by: taoberly | last post by:
A few months ago I posted a question about using a file on my hard drive to perform cross-frame scripting and pull data from a server on my company's intranet. I eventually got this working using an HTA file and Internet Explorer. Now I'm tackling a similar issue, but really need to keep the IE menus, navigation buttons, etc. this time...
2
1863
by: KZSteele | last post by:
hello - i am using VBA within a microsoft access project to automate internet explorer. what i am doing is reading data from various frames in the IE window and loading them into a table. however, this cross-frame scripting security with IE is really getting on my nerves. i can't even use VB to navigate to frames located on a different...
0
1219
by: KZSteele | last post by:
(repost/edit from html forum) hello - i am using VBA within a microsoft access project to automate internet explorer. what i am doing is reading data from various frames of my company's web site (non-intranet) and loading it into a table. however, this cross-frame scripting security with IE is getting in the way. i can't even use VB to...
3
2673
by: dotpranay | last post by:
Hi, I have two websites in my local IIS. Website A and B. A runs under SSL and B does not. A has a page that has an iframe showing B in that iframe. Both sites being on the same domain. i could write some code in a page in website B so that i can do cross frame scripting. This worked fine in my environment. But this did not work when i...
0
7414
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7598
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7360
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7699
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5895
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
4905
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3398
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
982
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
651
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.