SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict
    Join Date
    Nov 2000
    Posts
    224
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Resize and remove menu etc using onload

    Hi all,

    I've been trying to find a way to get an external HTML page on myspace.com but it's looking unlikely I'm going to be able to do it.

    Basically the site blocks the use of IFrame, Object and Embed (apart from .swf files) so the only other is to use Javascript, however this is also blocked within myspace.

    So, it is possible to have some JS in the external page to resize it, remove menus/toolbar and position it using the onload function?

    So it would work like this.

    The link on the myspace page would just be a standard HTML link which the user would click to open the new (external) page.
    The page would open in a new browser window and when it loads, it resizes itself, removes the menu/toolbar/address etc and positions itself.
    When the external page does all this, the original browser and myspace page would remain unchanged so the user can then close the popup when finished and still be on myspace.

    I'm not to good with JS so will need a bit of help if that's ok.

    thanks

  2. #2
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    Join Date
    Sep 2005
    Location
    Tanzania
    Posts
    4,662
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    I don't see why it shouldn't be possible, but you should be aware that a lot of popup blockers will probably block this. Does myspace block the usage of the target attribute in links? If so you might have issues making the links open in new windows.

    Anyway, assuming your link has successfully launched in a new window, you can resize and move it using some of these functions by attaching them to the onload event. You can't remove the toolbar and menubar in an existing window, only window.open can do that.

    The only foreseeable problem is that the repositioning/resizing will occur after the page has loaded, so the user will see the fullscreen window first (or at whatever the default size is for a new window) and then once the content has loaded, it will move and resize.

    Something that you could do, but is a bit messy, is make your link point to some page and then that page immediately opens your actual popup window using window.open (where you can remove the toolbar, resize it and put it where you want) and closes itself. The drawback is that the user might see a quick flicker of this window opening and closing just before the popup appears.

    I can't think of any other way of doing this.

  3. #3
    SitePoint Addict
    Join Date
    Nov 2000
    Posts
    224
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Raffles, whatever I try t do with this is a work around and it's gonna be a bit messy, but hey it's myspace.com so I think everyone that uses it are used to a mess ;-) It is looking like I'm gonna have to use the option of linking to one page that has the JS then opens another page and closes itself......


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •