Tooltip not appears during window.createPopup


V

Vivek

I have two html files Parent.htm and Child .htm

Following is the code inside the Parent.htm:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title></title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
<script language=javascript>
var globalPopWindow = typeof(window) != "undefined" ?
window.createPopup() : null;
pop=globalPopWindow;
popdb=pop.document.body;

function wfCreateContextMenuHtml(xPos, ypos){
// Creating Context menu with the help of Div
var str=[];
str.push('<div style="border:eek:utset">');
str.push('<a href="#" title="This is Test Menu">This is Test
Menu</a>');
str.push('</div>');
popdb = document.getElementById("test");
popdb.innerHTML = str.join('');
popdb.style.zIndex = 1000
popdb.style.visibility = "visible"
popdb.style.left = xPos
popdb.style.top = ypos
popdb.style.width = 135
popdb.style.height = 20
return false;
}

function wfCreateContextMenuHtml1(xPos, ypos){
// Creating Context menu with the help of window.createPopup()
var str=[];
str.push('<div style="border:eek:utset">');
str.push('<a href="#" title="This is Test Menu">This is Test
Menu</a>');
str.push('</div>');
popdb.innerHTML = str.join('');
pop.show(xPos,ypos,135,20,popdb)
return false;
}
</script>
</head>
<body>
<a href="#">Hello Test</a>
<div id="test" style="position:absolute"></div>
<iframe src="child.htm" style="position:absolute"></iframe>
</body>
</html>


Following is the code for Child.html:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title></title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
</head>
<body oncontextmenu="return
parent.wfCreateContextMenuHtml(event.clientX, event.clientY)">
<A href="#" title="Test Page" style="text-underline:none">Test Page</A>
</body>

</html>


If i call the wfCreateContextMenuHtml() mehtod using url:
http://testdomain.com/Parent.htm then tooltip is appear in the context
menu. but if i call wfCreateContextMenuHtml1() mehtod using url:
http://testdomain.com/Parent.htm then tooltip is not appear in the
context menu.

And if i access the Parent.htm file using URL
http://locahost/Parent.htm, that time in both mehtods tooltip appears.
 
Ad

Advertisements

V

Vivek Kwatra

Tooltip will not appear during window.createpoup because of security
restriction

http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/overview/window_restric.asp

above url have detail explanation for windows.createpopup restriction.
I have two html files Parent.htm and Child .htm

Following is the code inside the Parent.htm:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title></title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
<script language=javascript>
var globalPopWindow = typeof(window) != "undefined" ?
window.createPopup() : null;
pop=globalPopWindow;
popdb=pop.document.body;

function wfCreateContextMenuHtml(xPos, ypos){
// Creating Context menu with the help of Div
var str=[];
str.push('<div style="border:eek:utset">');
str.push('<a href="#" title="This is Test Menu">This is Test
Menu</a>');
str.push('</div>');
popdb = document.getElementById("test");
popdb.innerHTML = str.join('');
popdb.style.zIndex = 1000
popdb.style.visibility = "visible"
popdb.style.left = xPos
popdb.style.top = ypos
popdb.style.width = 135
popdb.style.height = 20
return false;
}

function wfCreateContextMenuHtml1(xPos, ypos){
// Creating Context menu with the help of window.createPopup()
var str=[];
str.push('<div style="border:eek:utset">');
str.push('<a href="#" title="This is Test Menu">This is Test
Menu</a>');
str.push('</div>');
popdb.innerHTML = str.join('');
pop.show(xPos,ypos,135,20,popdb)
return false;
}
</script>
</head>
<body>
<a href="#">Hello Test</a>
<div id="test" style="position:absolute"></div>
<iframe src="child.htm" style="position:absolute"></iframe>
</body>
</html>


Following is the code for Child.html:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title></title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
</head>
<body oncontextmenu="return
parent.wfCreateContextMenuHtml(event.clientX, event.clientY)">
<A href="#" title="Test Page" style="text-underline:none">Test Page</A>
</body>

</html>


If i call the wfCreateContextMenuHtml() mehtod using url:
http://testdomain.com/Parent.htm then tooltip is appear in the context
menu. but if i call wfCreateContextMenuHtml1() mehtod using url:
http://testdomain.com/Parent.htm then tooltip is not appear in the
context menu.

And if i access the Parent.htm file using URL
http://locahost/Parent.htm, that time in both mehtods tooltip appears.
 
Ad

Advertisements

R

RobG

Vivek said:
I have two html files Parent.htm and Child .htm

Following is the code inside the Parent.htm:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title></title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
<script language=javascript>

The language attribute has been deprecated for many, many years in
favour of the required type attribute:

<script type="text/javascript">


I'll guess that your "GENERATOR" is inserting it automatically, maybe
it's time to get a development environment that understands web
standards after 1997.

var globalPopWindow = typeof(window) != "undefined" ?
window.createPopup() : null;

The test is ill conceived - if 'window' is anything other than
undefined you assume it has a 'createPopup' method - my browser doesn't
so throws an error.

typeof is an operator, not a function so the use of () following it is
unnecessary and somewhat misleading - it makes it look like a method.
You may like to encapsulate the statement for maintenance:

if ('object' != (typeof window)) { ... }


A better test would be:

var globalPopWindow;
if ('object' == (typeof window) &&
'function' == (typeof window.createPopup)){
globalPopWindow = window.createPopup();
}

The rest of your code assumes that the window was opened, a good number
of browsers will not open it. So test globalPopWindow before trying to
us it - if there is no popup window, skip the rest of the function.
[...]
<body oncontextmenu="return

My browser doesn't support oncontextmenu either...
parent.wfCreateContextMenuHtml(event.clientX, event.clientY)">
<A href="#" title="Test Page" style="text-underline:none">Test Page</A>

text-underline is not a valid CSS property, I think the property you
are after is text-decoration:

text-decoration: none

</body>

</html>


If i call the () mehtod using url:
http://testdomain.com/Parent.htm then tooltip is appear in the context
menu. but if i call wfCreateContextMenuHtml1() mehtod using url:
http://testdomain.com/Parent.htm then tooltip is not appear in the
context menu.

And if i access the Parent.htm file using URL
http://locahost/Parent.htm, that time in both mehtods tooltip appears.

I don't really understand what you are saying here, but you likely have
discovered cross-domain scripting isn't allowed with default security
settings.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top