Jump to content

window.open works on test page, not on site page


george

Recommended Posts

On my test page, window.open works fine. window.open will not work on my actual site pageThe javascript and html for opening the page is identical in both instances. My site page validated fine for me, as did my test page. I assume that something in the actual site page is preventing the window.open function from functioning.

Link to comment
Share on other sites

Here is the code from the working test site. The exact same code is used in the actual site, but there is other code in there which is interfereing with the simple function working. In both instances, you click on the Sun icon to open the new window. This code works

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Untitled Document</title><script type="text/javascript" >	function showHits() { 		var woURL = "/ForumOneProposal/hits.php";		var woName = "_blank";		var woSpecs = "directories=no, height=400, left=50, location=no, menubar=no, resizable=no, status=no, titlebar=no, toolbar=no, top=150, width=876";		var woReplace	= "replace=false";		var myWindow=window.open(woURL,woName,woSpecs,woReplace);	}	</script></head><body>	<div style='cursor:hand' onclick='showHits()'><img src='/images/WB01330_.GIF' width='37' height='37' alt='A little icon image of the sun.' /></div></body></html>

Link to comment
Share on other sites

Is the URL correct on this line in both instances?var woURL = "/ForumOneProposal/hits.php";
Yes. Both sites reference the same URL from the same file system root, though the calling pages were in different locations, I corrected for this, and the problem remains. I've also tried using the fully qualified URL rather than the system root. Still not functional. I didn't publish the source code for the actual site because it is extensive. However, I did provide a link to it, and as you likely know, viewing HTML source is available in most browsers. JavaScript source (where I believe the problem lies) can be viewed using Firefox and pasteing into the browser's address bar the url of the javascript file, which in my case is the site url with "new.html" replaced with the javascript file name, "new.js". Somewhere, there must be a tool or methodology for finding what in my Javascript code causes the actual site code to not respond to the windows.open command. In both instances, clicking on the sun icon will (test) or should (actual site) open a new browser window.
Link to comment
Share on other sites

Yes, I am aware of the ability to view the source HTML and JavaScript. Unfortunately, I am unable to visit your site since company policy forbids it (yes, I'm at work).Do you have a debugger (FireBug for FireFox)? Check your debugger when you try to run your code on your live site. What (if any) errors does it report?

Link to comment
Share on other sites

There are several tools you can use to help debug Javascript, such as Firebug for Firefox. Opera includes the Dragonfly debugger, and IE has a set of developer tools. There's a Javascript error on that page which says that "preload is not defined".

Link to comment
Share on other sites

There are several tools you can use to help debug Javascript, such as Firebug for Firefox. Opera includes the Dragonfly debugger, and IE has a set of developer tools. There's a Javascript error on that page which says that "preload is not defined".
I looked at it with Firebug - I will look deeper - I hadn't even noticed the "preload" error. Thanks for pointing me in the right direction.
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...