Question: I have just started using JSC3D.

I have followed the getting started guide in the documentation: <https://code.google.com/p/jsc3d/wiki/GettingStarted>

The code seems fine but my file does not seem to load, the loading bar just freezes.

```
 <!DOCTYPE HTML>
<HTML>
<HEAD>
<TITLE>Loader</TITLE>
<script type="text/javascript" src="jsc3d/jsc3d.js"></script>
<script type="text/javascript" src="jsc3d/jsc3d.webgl.js"></script>
<script type="text/javascript" src="jsc3d/jsc3d.touch.js"></script>
</HEAD>

<BODY>
<div style="width:800px; margin:auto; position:relative;">
    <canvas id="cv" style="border: 1px solid;" width="750" height="400">
        It seems you are using an outdated browser that does not support canvas :-(
    </canvas>
</div>

<script type="text/javascript">
        var viewer = new JSC3D.Viewer(document.getElementById('cv'));
        viewer.setParameter('SceneUrl',         'cube.obj');
        viewer.setParameter('ModelColor',       '#CAA618');
        viewer.setParameter('BackgroundColor1', '#E5D7BA');
        viewer.setParameter('BackgroundColor2', '#383840');
        viewer.setParameter('RenderMode',       'flat');
        viewer.init();
        viewer.update();
    </script>

</BODY>
</HTML>

```

Does anyone know where I am going wrong?

Regards,

Mr B

EDIT: Seem to work fine when not testing in chrome. Could be a problem with loading external files in chrome.

Answer: 
You need to make the window focused:

```
chrome.tabs.create({url:someUrl}, function(tab){
  chrome.windows.update(tab.windowId, {focused: true});
});

```

---

In a case that there is no active window, you need to account for that and create one if required:

```
chrome.tabs.create({url:someUrl}, function(tab){
  if(!tab) {
    // Probably, there was no active window
    chrome.windows.create({url:someUrl, focused:true});
  } else {
    chrome.windows.update(tab.windowId, {focused: true});
  }
});

```

Note that this will probably not respect the default window state (maximized/normal), but better than nothing. I tested it on an extension with `"background"` permission.
*This answer only applies to Linux and Mac (not to Windows where the bug in question does not exist).*

A Chrome extension cannot focus a window unless at least a part of Chrome is the currently active window. I reported this bug a month ago with a detailed steps-to-reproduce as [Issue 407817: chrome.windows.create({ focused:true }) within a desktop notification does not create a focused window](https://code.google.com/p/chromium/issues/detail?id=407817).

Unfortunately, there is nothing that you can do in an extension. If it's a personal extension, you could create a [native messaging host](https://developer.chrome.com/extensions/messaging#native-messaging) and write a native application that puts the focus on the new window (if it is not a personal extension, then you have to ask your users to also install that native messaging host).