views:

23

answers:

1

I'm trying to make my Gadget html to navigate to another page, but when I try to do it via

window.location = 'http://newurl.com'

It opens the address in a default browser new window.

All I could do so far is to iframe the page in the gadget html (in the flyout html it didn't work), but the site I'm trying to frame has a frame detector and won't allow it.

+1  A: 

You can't change the location of a gadget file to a remote location. There are ways to get it working but I don't remember what they are right now (or if they were fixed in Win 7). There's also a security risk - gadgets run with higher privaleges than web pages so they have access to the clipboard, cross domain web requests and can run unsigned ActiveX controls that are not marked as safe for scripting.

If you're willing to use COM, then you can use the WebBrowser control that comes with windows, with certain limitations. You will only be able to communicate with the original domain the control is loaded with, if the user navigates away from this domain access will be blocked by the same origin policy.

<OBJECT ID="WebBrowser1" WIDTH=332 HEIGHT=276
     CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2">
    <PARAM NAME="ExtentX" VALUE="8784">
    <PARAM NAME="ExtentY" VALUE="7303">
    <PARAM NAME="ViewMode" VALUE="1">
    <PARAM NAME="Offline" VALUE="0">
    <PARAM NAME="Silent" VALUE="0">
    <PARAM NAME="RegisterAsBrowser" VALUE="0">
    <PARAM NAME="RegisterAsDropTarget" VALUE="0">
    <PARAM NAME="AutoArrange" VALUE="1">
    <PARAM NAME="NoClientEdge" VALUE="1">
    <PARAM NAME="AlignLeft" VALUE="0">
</OBJECT>

If you can't live with those limitations, your only option is to create your own ActiveX control that references the WebBrowser control and proxy the commands.

See also, http://support.microsoft.com/kb/176789.

Andy E