Jump to content


Photo

Control another browser window.


  • Please log in to reply
9 replies to this topic

#1 iPixel

iPixel
  • Members
  • PipPipPip
  • Advanced Member
  • 496 posts

Posted 23 May 2006 - 05:24 PM

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.

#2 iPixel

iPixel
  • Members
  • PipPipPip
  • Advanced Member
  • 496 posts

Posted 25 May 2006 - 03:33 PM

/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) View Post[/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]


#3 king arthur

king arthur
  • Members
  • PipPipPip
  • Advanced Member
  • 335 posts
  • LocationUK HQ

Posted 01 June 2006 - 07:07 PM

You can open a new browser window from the current one with javascript:

newWindow = window.open("yourURL", "yourwindowName")

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?
Sir Isaac Newton said "If I have seen farther, it is by standing on the shoulders of giants". But it is not recorded as to whether he said it before or after he was hit on the head by a falling apple.

#4 iPixel

iPixel
  • Members
  • PipPipPip
  • Advanced Member
  • 496 posts

Posted 08 June 2006 - 01:30 PM

Slightly .. but im trying to control a window that is already opened ... its a whole seperate site.



Thanks.

#5 nogray

nogray
  • Members
  • PipPipPip
  • Advanced Member
  • 930 posts
  • LocationSan Francisco CA

Posted 08 June 2006 - 05:10 PM

Scripts cannot control a page or a window on a different domain (security risk).

NoGray.com


#6 iPixel

iPixel
  • Members
  • PipPipPip
  • Advanced Member
  • 496 posts

Posted 08 June 2006 - 05:17 PM

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.

#7 king arthur

king arthur
  • Members
  • PipPipPip
  • Advanced Member
  • 335 posts
  • LocationUK HQ

Posted 08 June 2006 - 08:16 PM

Javascript can only control a browser window it has opened itself. It doesn't matter what the URL is.
Sir Isaac Newton said "If I have seen farther, it is by standing on the shoulders of giants". But it is not recorded as to whether he said it before or after he was hit on the head by a falling apple.

#8 iPixel

iPixel
  • Members
  • PipPipPip
  • Advanced Member
  • 496 posts

Posted 08 June 2006 - 09:01 PM

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 ?

#9 nogray

nogray
  • Members
  • PipPipPip
  • Advanced Member
  • 930 posts
  • LocationSan Francisco CA

Posted 08 June 2006 - 09:18 PM

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]

NoGray.com


#10 iPixel

iPixel
  • Members
  • PipPipPip
  • Advanced Member
  • 496 posts

Posted 09 June 2006 - 02:40 PM

Thanks ill look into this .hta thing.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users