views:

38

answers:

1

Hello,

I'm trying to get my users to download "maps" from bungie.net from my website.

Example map:

http://www.bungie.net/Online/Halo3UserContentDetails.aspx?h3fileid=31604914

Link users need to click to download map:

<a id="ctl00_mainContent_xboxDownloadButton" href="javascript:__doPostBack('ctl00$mainContent$xboxDownloadButton','')">Download to Halo 3</a>

When a user clicks this link the map is downloaded to the users Xbox 360.


Option 1:

I tried opening a hidden iframe then when the user clicks on a link JavaScript will load into my iframe. Thus downloading the map. The only problem is it doesn't work.

> <iframe name="download_frame"
> src="http://www.bungie.net/Online/Halo3UserContentDetails.aspx?h3fileid=1244"
> width="0px" height="0px"></iframe> <a
> href="javascript:__doPostBack('ctl00$mainContent$xboxDownloadButton','')"
> target="download_frame">Download</a>

Option 2:

Is it possible to have a link with a src something like this...

URL + JavaScript

Option 3:

Any other suggestions of how to get users to download this map without having to go to this website would be great.

A: 

I don't know if this will work... it should be treated as pseudo-code as I'm not testing this as I go along but might help.

How about having a standard HTML page for use as an IFRAME, lets call it "dl.html"

Within dl.html have the following Javascript:

<script>
var file=location.has.replace('#','');
if (file) {
  var target='http://www.bungie.net/Online/Halo3UserContentDetails.aspx?h3fileid='+file;
  location.href=target;
}
</script>

In your parent HTML page, have this:

<script>
  function downloadFile(id) {
    var f=document.createElement('iframe');
    f.setAttribute('id','whatever');
    f.style.border='0px';
    f.style.width='0px';
    f.style.height='0px';
    f.setAttribute('src','dl.html#'+id);
    fo = document.body.appendChild(f); 

  }
</script>
<a href="javascript:downloadFile('31604914')">Download to Halo 3</a>

Hope that helps, or fires some neurons...

michael
Hello michael, This only opens the page to download the map from web to xbox 360. The user then needs to click on the "download to halo 3" link when on this page. I need it so the user dose not need to go to bungie.net and get it so the user can just download it from my website.
NeedsHelp