Jump to content

Archived

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

iPixel

Control another browser window.

Recommended Posts

Please read >

[a href=\"http://www.phpfreaks.com/forums/index.php?showtopic=94053\" target=\"_blank\"]http://www.phpfreaks.com/forums/index.php?showtopic=94053[/a]

I was sent here .. can someone help me out.

Thanks in advance.

Share this post


Link to post
Share on other sites
/bump [img src=\"style_emoticons/[#EMO_DIR#]/unsure.gif\" style=\"vertical-align:middle\" emoid=\":unsure:\" border=\"0\" alt=\"unsure.gif\" /]

[!--quoteo(post=376402:date=May 23 2006, 01:24 PM:name=iPixel)--][div class=\'quotetop\']QUOTE(iPixel @ May 23 2006, 01:24 PM) [snapback]376402[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Please read >

[a href=\"http://www.phpfreaks.com/forums/index.php?showtopic=94053\" target=\"_blank\"]http://www.phpfreaks.com/forums/index.php?showtopic=94053[/a]

I was sent here .. can someone help me out.

Thanks in advance.
[/quote]

Share this post


Link to post
Share on other sites
You can open a new browser window from the current one with javascript:

[code]
newWindow = window.open("yourURL", "yourwindowName")
[/code]

where yourURL is the address of the page you want opened, and yourwindowName is the object name. You can now address objects in the new window using newWindow.document.whatever... Does this help any?

Share this post


Link to post
Share on other sites
Slightly .. but im trying to control a window that is already opened ... its a whole seperate site.



Thanks.

Share this post


Link to post
Share on other sites
Scripts cannot control a page or a window on a different domain (security risk).

Share this post


Link to post
Share on other sites
Ive seen this done with C-sharp.... any idea why that isnt considered a "Security Risk" ?

It was basically a PC application that found a specific and specified window (hard coded) that was already opened and basically
controlled it. Im attempting the same with JavaScript.

Share this post


Link to post
Share on other sites
Javascript can only control a browser window it has opened itself. It doesn't matter what the URL is.

Share this post


Link to post
Share on other sites
So how about if i were to open the PCS site with a pop up script... window.open.blahblahblah

would that allow me to gain control over the pages objects ?

Share this post


Link to post
Share on other sites
Even if the javascript opened the window, you cannot get any elements from the new window if it was in a different domain. For example, if you are trying to get the HTML code, or a input value. You'll get "Access Denied" error.

Here are general restriction when opening a window, from MSDN
[a href=\"http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/overview/window_restric.asp\" target=\"_blank\"]http://msdn.microsoft.com/library/default....dow_restric.asp[/a]

If the application was a desktop application (or a PC) application, it'll be considered as a trusted application so there are less restrictions.

You can try to create an HTA file (normal HTML, just rename it to something.hta) which is a trusted html application. It'll have less restrictions, and you can run it from you PC. I am not sure if you can access remote sites with it or not.

[a href=\"http://msdn.microsoft.com/library/default.asp?url=/workshop/author/hta/overview/htaoverview.asp\" target=\"_blank\"]http://msdn.microsoft.com/library/default....htaoverview.asp[/a]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.