access denied using mywindow.moveTo() ?

G

geoff

Hello

I get an error message, "access denied", when using mywindow.moveTo
with IE8 when using

<script type="text/javascript">
function mypopup(name_site) {
mywindow = window.open(name_site, "mywindow",
"location=1,status=1,scrollbars=1,width=1000px,height=700px");
mywindow.moveTo(0, 0);
}
</script>

The name_site is something like www.fred.com which is a different
domain name from the website where my files are hosted.

Does this mean that it is not possible to use a popup to show these
other sites?

Incidentally Microsoft in their Windows 7 Client web forum for
partners have not been able to help!

Cheers

Geoff
 
S

SAM

Le 02/05/11 16:06, (e-mail address removed) a écrit :
Hello

I get an error message, "access denied", when using mywindow.moveTo
with IE8 when using

most of browsers do not more accept that JavaScript moves or resizes
their windows

keep it in mind
 
G

geoff

Le 02/05/11 16:06, (e-mail address removed) a écrit :

most of browsers do not more accept that JavaScript moves or resizes
their windows

keep it in mind

Stephane

The latest Firefox works OK with mywindow.moveTo!

Oddly IE8 with <a href="http://www.fred.com
onclick="target='display'">fred</a>

brings up a new window looking just like Firefox with mywindow.moveTo!

Cheers

Geoff
 
G

geoff

Le 02/05/11 16:06, (e-mail address removed) a écrit :

most of browsers do not more accept that JavaScript moves or resizes
their windows

keep it in mind

Stephane

another oddity?

http://www.micro-active.com/styles/style8/a-popup.htm

work OK with no error message in IE8.

http://www.micro-active.com/styles/style8/index-test.htm

using the same code does give the error message re

dmcaWin.moveTo(100,200); (access denied)

Without the moveTo I get no errors in IE8.

The comment people tend to make is that this a security measure in IE
when a foreign domain name is used .. but even with the error message
the foreign website is opened.

What is going on?!

Geoff

the code used is

<script type="text/javascript">

function popUpAtMyWish( pageToLoad, winName, width, height)
{
xposition=0; yposition=0;
if ((parseInt(navigator.appVersion) >= 4 )){
xposition = (screen.width - width);
yposition = (screen.height - height);
}

var args = "";
args += "width=" + width + "," + "height=" + height + ","
+ "location=0,"
+ "menubar=0,"
+ "resizable=0,"
+ "scrollbars=0,"
+ "statusbar=false,dependent,alwaysraised,"
+ "status=false,"
+ "titlebar=no,"
+ "toolbar=0,"
+ "hotkeys=0,"
+ "screenx=" + xposition + "," //NN Only
+ "screeny=" + yposition + "," //NN Only
+ "left=" + xposition + "," //IE Only
+ "top=" + yposition; //IE Only
var dmcaWin = window.open(pageToLoad,winName,args );
dmcaWin.moveTo(100,200);
dmcaWin.focus();
}

</script>
</head>

<body>

<p><input type="button" value="Business Studies site"
onclick="javascript:
popUpAtMyWish('http://www.bestbusinessteacher.com','mywindow',800,500)"></p>
 
E

Erwin Moller

Stephane

The latest Firefox works OK with mywindow.moveTo!

Oddly IE8 with<a href="http://www.fred.com
onclick="target='display'">fred</a>

The above line isn't correct.
I am surprised clicking the hyperlink even does anything.

the href=".." misses the last ".

Fix that first before debugging it. ;-)

Erwin Moller
 
E

Erwin Moller

Erwin

I don't see anything wrong with either

http://www.micro-active.com/styles/style8/a-popup.htm

or

http://www.micro-active.com/styles/style8/index-test.htm

Neither give any errors with W3C HTML Validator. Have I missed
something?

You missed that I was addressing your code you posted here.
This is what you posted:

<a href="http://www.fred.com
onclick="target='display'">fred</a>

Look here:
href="http://www.fred.com <-- missing "

About your urls:
http://www.micro-active.com/styles/style8/a-popup.htm
That only contains a button and some code to create a new window.

I happened to see the following:

<input type="button" value="Business Studies site" onclick="javascript:
popUpAtMyWish('http://www.bestbusinessteacher.com','mywindow',800,500)">

Why do you put javascript: in your onclick-handler?
Looks like pseudoprotocol for a href to me (which you should avoid too).

Regards,
Erwin Moller
 
G

geoff

You missed that I was addressing your code you posted here.
This is what you posted:

<a href="http://www.fred.com
onclick="target='display'">fred</a>

Look here:
href="http://www.fred.com <-- missing "

About your urls:
http://www.micro-active.com/styles/style8/a-popup.htm
That only contains a button and some code to create a new window.

I happened to see the following:

<input type="button" value="Business Studies site" onclick="javascript:
popUpAtMyWish('http://www.bestbusinessteacher.com','mywindow',800,500)">

Why do you put javascript: in your onclick-handler?
Looks like pseudoprotocol for a href to me (which you should avoid too).

Erwin,

Oops! I have removed the "javascript:".

Now both give the access denied error message with IE8 but not with
Firefox. The window does contain the new website even though I get
the access denied error - so what does the access denied apply to?

Without the

dmcaWin.moveTo(100,200);

neither

http://www.micro-active.com/styles/style8/index-test2.htm

nor

http://www.micro-active.com/styles/style8/a-popup2.htm

give this error message.

Cheers

Geoff
 
E

Erwin Moller

Erwin,

Oops! I have removed the "javascript:".

Now both give the access denied error message with IE8 but not with
Firefox. The window does contain the new website even though I get
the access denied error - so what does the access denied apply to?

Without the

dmcaWin.moveTo(100,200);

neither

http://www.micro-active.com/styles/style8/index-test2.htm

nor

http://www.micro-active.com/styles/style8/a-popup2.htm

give this error message.

Like SAM said earlier:
"most of browsers do not more accept that JavaScript moves or resizes
their windows. keep it in mind."

You cannot do so reliably (anymore).
Do you remember those funny browserswindows that jumped away when your
mouse entered them? Funny for one time maybe.
So, it is considered an annoying feature and not implemented (or
enabled) on default in some browsers.

I think that most browsers still honor the screenx/left and screeny/top
settings for initial placement of the new window.

Erwin Moller
 
J

Jeff North

| Hello
|
| I get an error message, "access denied", when using mywindow.moveTo
| with IE8 when using
|
| <script type="text/javascript">
| function mypopup(name_site) {
| mywindow = window.open(name_site, "mywindow",
| "location=1,status=1,scrollbars=1,width=1000px,height=700px");
| mywindow.moveTo(0, 0);
| }
| </script>
|
| The name_site is something like www.fred.com which is a different
| domain name from the website where my files are hosted.
|
| Does this mean that it is not possible to use a popup to show these
| other sites?
|
| Incidentally Microsoft in their Windows 7 Client web forum for
| partners have not been able to help!
|
| Cheers
|
| Geoff

You might want to clean up some of your code - for example you are
loading the same scripts multiple times - can only hurt your visitors
download of the site. Not to mention if you decide to move to jQuery
1.5.2. (sorted in alphabetical order):
src="../../assets/javascripts/date2.js"
src="../../assets/javascripts/fadeslideshow-style1-new.js"
src="../../assets/javascripts/fadeslideshow-style8-new.js"
src="../../assets/javascripts/jquery-1.5.1.js"
src="../../assets/javascripts/jquery-1.5.1.js"
src="../../assets/javascripts/jquery-1.5.1.js"
src="../../assets/javascripts/jquery-1.5.1.js"
src="../../assets/javascripts/jquery-1.5.1.js"
src="../../assets/javascripts/jquery.corner.js"
src="../../assets/javascripts/jquery.featureCarousel.min.js"
src="../../assets/javascripts/jquery.featureCarousel.min.js"
src="../../assets/javascripts/soundmanager2.js"

Next, you have:
<p><input type="button" value="Business Studies site"
onclick="javascript:
popUpAtMyWish('http://www.bestbusinessteacher.com','mywindow',800,500)"></p>

If someone has javascript turned off then the link will not work (only
tested in FF4). It is best to forget about the psuedo-protocol on the
mouse events.

Safari : moveTo is not a function;
FF4 : Permission denied to access property 'moveTo'
http://www.micro-active.com/styles/style8/a-popup.htm
Line 34
IE 9 : Permission denied to access property 'moveTo'

If FF you can allow/disallow whether pages can move or resize your
windows ( options | Options | Content | Enable Javascript | Advanced |
Move or resize existing widows ) set to no by default.

Also, I run with 2 screens - the popup window opens on the opposite
screen that of my browser - very annoying :-(

You might consider using another display option like greybox/lightbox
or similar. I think jQuery has a lightbox plugin (since you are
already using jQuery).
 
G

geoff

You might want to clean up some of your code - for example you are
loading the same scripts multiple times - can only hurt your visitors
download of the site. Not to mention if you decide to move to jQuery
1.5.2. (sorted in alphabetical order):
src="../../assets/javascripts/date2.js"
src="../../assets/javascripts/fadeslideshow-style1-new.js"
src="../../assets/javascripts/fadeslideshow-style8-new.js"
src="../../assets/javascripts/jquery-1.5.1.js"
src="../../assets/javascripts/jquery-1.5.1.js"
src="../../assets/javascripts/jquery-1.5.1.js"
src="../../assets/javascripts/jquery-1.5.1.js"
src="../../assets/javascripts/jquery-1.5.1.js"
src="../../assets/javascripts/jquery.corner.js"
src="../../assets/javascripts/jquery.featureCarousel.min.js"
src="../../assets/javascripts/jquery.featureCarousel.min.js"
src="../../assets/javascripts/soundmanager2.js"

Next, you have:
<p><input type="button" value="Business Studies site"
onclick="javascript:
popUpAtMyWish('http://www.bestbusinessteacher.com','mywindow',800,500)"></p>

If someone has javascript turned off then the link will not work (only
tested in FF4). It is best to forget about the psuedo-protocol on the
mouse events.

Safari : moveTo is not a function;
FF4 : Permission denied to access property 'moveTo'
http://www.micro-active.com/styles/style8/a-popup.htm
Line 34
IE 9 : Permission denied to access property 'moveTo'

If FF you can allow/disallow whether pages can move or resize your
windows ( options | Options | Content | Enable Javascript | Advanced |
Move or resize existing widows ) set to no by default.

Also, I run with 2 screens - the popup window opens on the opposite
screen that of my browser - very annoying :-(

You might consider using another display option like greybox/lightbox
or similar. I think jQuery has a lightbox plugin (since you are
already using jQuery).

Thanks Jeff, I am making changes as suggested.

One oddity which you can perhaps explain?

If I remove the 2nd jquery-1.5.1.js link the carousel does not appear,
http://www.micro-active.com/styles/style1/index.htm

I wouldn't have expected that 2 links to jquery-1.5.1.js are needed?!

Cheers

Geoff
 
G

geoff

Like SAM said earlier:
"most of browsers do not more accept that JavaScript moves or resizes
their windows. keep it in mind."

You cannot do so reliably (anymore).
Do you remember those funny browserswindows that jumped away when your
mouse entered them? Funny for one time maybe.
So, it is considered an annoying feature and not implemented (or
enabled) on default in some browsers.

I think that most browsers still honor the screenx/left and screeny/top
settings for initial placement of the new window.

Erwin,

So it is a matter of being annoying rather than a security risk?

Cheers

Geoff
 
S

SAM

Le 02/05/11 21:56, (e-mail address removed) a écrit :
The latest Firefox works OK with mywindow.moveTo!

not mine ... (Firefox left in config "by default")

this of a friend of me doesn't even display a new window
(on best it opens a tab)
Oddly IE8 with<a href="http://www.fred.com
onclick="target='display'">fred</a>

brings up a new window looking just like Firefox with mywindow.moveTo!

<a href="test.htm" onclick="this.target='_blank'">test</a>

<a href="test1.htm" onclick="this.target='mywindow'">test1</a>
<a href="test2.htm" onclick="this.target='mywindow'">test2</a>

would have to work in IE or Fx (if their users permit new window)
 
G

geoff

Le 02/05/11 21:56, (e-mail address removed) a écrit :

not mine ... (Firefox left in config "by default")

this of a friend of me doesn't even display a new window
(on best it opens a tab)


<a href="test.htm" onclick="this.target='_blank'">test</a>

<a href="test1.htm" onclick="this.target='mywindow'">test1</a>
<a href="test2.htm" onclick="this.target='mywindow'">test2</a>

would have to work in IE or Fx (if their users permit new window)

Thanks Stéphane - will take another look at this.

I am trying the greybox technique for adding a new website in a window
with the parent page greyed out.

http://www.micro-active.com/styles/style8/index.htm

See the BEST site and the paintings sites etc.

Do these work OK for you?

Cheers

Geoff
 
S

SAM

Le 04/05/11 00:11, (e-mail address removed) a écrit :
On Tue, 03 May 2011 23:58:34 +0200, SAM

Thanks Stéphane - will take another look at this.

I am trying the greybox technique for adding a new website in a window
with the parent page greyed out.

http://www.micro-active.com/styles/style8/index.htm

See the BEST site and the paintings sites etc.

Do these work OK for you?

Not too bad ;-)

Perhaps a little short in height ?


(I think that 850ko is too heavy for an index page)


Why window.moveTo/resizeTo can't more work ?
Think about the new window opened in a tab instead of a window
then the user who sees his browser wriggling through the screen or
swelling or shrinking ... !
 
G

geoff

Le 04/05/11 00:11, (e-mail address removed) a écrit :

Not too bad ;-)
Stéphane

OK!

Perhaps a little short in height ?

I've changed height from 500 to 600.
(I think that 850ko is too heavy for an index page)

Not sure what you mean re the 850ko?
Why window.moveTo/resizeTo can't more work ?
Think about the new window opened in a tab instead of a window
then the user who sees his browser wriggling through the screen or
swelling or shrinking ... !

I've used

<a href="http://www.bestbusinessteacher.com"
onclick="target='display'"> etc

is this what you think is the best way?

Cheers

Geoff
 
E

Erwin Moller

Erwin,

So it is a matter of being annoying rather than a security risk?

I think so.
But you ask the makers of the browsers in question of course, and not
me. ;-)

Regards,
Erwin Moller
 
E

Erwin Moller

Erwin,

So it is a matter of being annoying rather than a security risk?

I think so, yes.
But you should ask the makers of the browsers why they decided to block
moveTo(), not me. ;-)

Regards,
Erwin Moller
 
E

Erwin Moller

I've changed height from 500 to 600.


Not sure what you mean re the 850ko?

I think it was a typo. He probably meant 850 KB.
(You load a lot of JavaScript, also JavaScript of questionably quality.)

Also: I don't see anything in the carousel part with JavaScript disabled
in my browser. (I didn't test the functionality of the rest of the page.)

If you want to be more friendly to visitors with JavaScript disabled,
you could place at least an image in that section with a hyperlink to
view all the images.

Regards,
Erwin Moller
 
G

geoff

I think it was a typo. He probably meant 850 KB.
Erwin

Understood.

(You load a lot of JavaScript, also JavaScript of questionably quality.)

which is the worst?!
Also: I don't see anything in the carousel part with JavaScript disabled
in my browser. (I didn't test the functionality of the rest of the page.)

If you want to be more friendly to visitors with JavaScript disabled,
you could place at least an image in that section with a hyperlink to
view all the images.

OK - will think about this.

Cheers

Geoff
 

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

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,190
Members
46,736
Latest member
zacharyharris

Latest Threads

Top