View Full Version : html, java script problem.. opening new window
Up_All_Night
09-03-2005, 02:01 AM
Im doing a resdesign of an old page i have.
Ive gone back to what i learnt at Uni in html, java script, and i made a similar styled page for an assignment. All worked back then 2003 or whenever. Now i am using the exact same code for this and getting told
"to help protect your security, Internet Explorer has restricted this file from showing active content that could access your computer"
im sure this is one of those stupid XP service pack 2 things, but can anyway please suggest to me what to change in this code to fix this.
<html>
<head>
<title>Stupid Webpage</title>
</head>
<script>
function openWindow() {
window.open("franmes", "newWin", "width=800,height=600")
}
</script>
<body onLoad="openWindow()">
<center><img src="title.gif" border="0" width="424" height="60"/>
<br>
<br>
<a href="#" onClick="openWindow()"><img src="frontpic.gif" border="0" alt="Enter" width="400" height="276"></a>
</center>
</body>
</html>
thanks heaps to anyone who can help
s3raph
09-03-2005, 02:06 AM
Yeah security sucks dude. My lecturer was telling me about how when he was a kid he wrote an assembly program that would make the head jump around on the hard drive, to play a tune, but security stops you from doing that nowadays.
druid
09-03-2005, 03:52 AM
I think your problem is that you are trying to spawn a window when the page is loaded (body onLoad...). This satanic behaviour is rightly blocked.
For the clickable part: instead of <a href="#" onClick="openWindow()">
Try <a href="javascript:openWindow()">
According to my testing that works in IE and Firefox which both have popup blocking. We're using this method to display an online help in a web application.
Up_All_Night
09-03-2005, 01:59 PM
see i understand it blocking the onLoad.. thats fine
even removing that, and changing the link code, it still says active content is blocked.
iots really frstrating, cause i cant figure out whats missing, or what i need to change
dwarfthrower
09-03-2005, 02:06 PM
You're running this right off the file system? Not using a web server of any sort?
IE places heavy restrictions on files in the "My Computer" domain because of the possibility that they've been downloaded onto your maching surreptitiously and could conceivably compromise admin rights over your system.
Try firing up IIS (or any other web server) and run it from there.
btwong
09-03-2005, 02:12 PM
I am also a web developer, and it looks fine to me with druid's addition.
When i first load the page, a pop-up appears (that is when i allow pop-ups with firefox)
druid
09-03-2005, 08:14 PM
You're running this right off the file system? Not using a web server of any sort?
IE places heavy restrictions on files in the "My Computer" domain because of the possibility that they've been downloaded onto your maching surreptitiously and could conceivably compromise admin rights over your system.
Try firing up IIS (or any other web server) and run it from there.
That must be it. I got that when I was toying with a flash game locally. I tested the above code straight off the web because JSPs are kinda hard to view without an app server...
Also I'd like to add that I prefer putting the popup call in the href because that way the user can see what the link is going to open instead of the #. This is something many have learned to expect.
You can make the URL visible if you use a parameter in the function like this:
javascript:openpopup('/agil/help.html#Portfolio')
In our case the actual function looks like this
function openpopup(popurl){
var winpops=window.open(popurl, "", "width=500px, height=400px, top=100px, left=100px, scrollbars")
}
An additional benefit is that now you can reuse the code for all similar popups.
P.S. I'm not really a web developer (can you tell?) but this is common programming sense.
Up_All_Night
09-03-2005, 11:26 PM
thanks heaps guys, if i could give more rep i would
vBulletin® v3.7.2, Copyright ©2000-2008, Jelsoft Enterprises Ltd.