Weird Javascript window.open problem

software development

#1

Hey guys,

I know that opening a new window via javascript is quite simple, but I’ve come across quite a weird problem.

In my body tag, I have , which references to a javascript function that is one line of code…

window.open(“popup.html”,“DVD”,“height=425,width=650”);

Now the thing is, when I test this locally, it works fine, just as it should. But as soon as I upload it, it doesn’t work at all (i.e. the window doesnt popup). This is in both FF and IE. I’ve viewed the source of the page and it does have the new code in there.

I’ve tried putting the window.open directly into the onload and once again works locally but not online. I’ve tried onLoad=“javascript:popup();” and again, the same thing.

I’ve checked the javascipt console too, and nothing is appearing in there, so there doesn’t seem to be any javascript errors.

Any ideas?


#2

My guess is it can not find your html page. Try using a full url address and see if it pops up.
Silk


#3

Sorry, forgot to say I tried that already too :slight_smile:


#4

Try single quotes instead of double. Not sure if that will help, but something to try.
Silk


#5

I had single quotes originally, and then changed to double.

Hadn’t tried single with full URL before, but same thing just happened. Offline is fine, online doesn’t work.

Could it be dreamhost blocking that function call on the body onload tag? I’ve used window.open on onclick events on links elsewhere on the site, and they work fine, it’s just this onload that doesnt want to work.


#6

Are you sure it’s not a firewall or popup blocker setting? It would make sense since they might see your own computer as a safe zone, but block the same code when it’s on the internet.

Other than that, Javascript is client-side, so nothing about DH should be affecting it that I can think of.


:stuck_out_tongue: Save up to $96 at Dreamhost with 96DOLLARSOFF promo code (I get $1).
Or save $97 with TAKESEILERSCASH.


#7

Well there you go. I disabled norton and it worked just fine. Damn programs doing their jobs :slight_smile:

Thanks for all your help guys.


#8

Glad it worked out. :wink:

Actually, you said you tested it with the full URL on your computer, and it worked?

That would almost seem like a possible hole in their security, if someone could get you to download one HTML file to your computer, then just pop the one they really wanted you to see from there. Not sure if that would work or not, but it would seem that way.

I don’t like/use Norton, but if you poke around in the settings, there should probably be a way to whitelist your sites, or add them to a trusted zone, so you don’t have to disable it when you’re working on something.


:stuck_out_tongue: Save up to $96 at Dreamhost with 96DOLLARSOFF promo code (I get $1).
Or save $97 with TAKESEILERSCASH.