title: Opening a PDF file in Windows Phone
body: <p>I'm developing an app for Windows Phone 7 and I'm using a Phonegap template for it.
  Everything looks perfect, but now I’m stuck trying to open a PDF file in the browser.
  I tried the following but that doesn’t work because the url of the PDF exceeds the 2048 character limit (it’s a data url). This code runs after the deviceReady event was fired.</p>
  
  <pre><code>var ref = window.open('http://www.google.com', '_blank', 'location=no');
  ref.addEventListener('loadstart', function () { alert(event.url); });
  </code></pre>
  
  <p>Now, I'm trying to save the PDF file to storage and then I'm trying to have it opened by the browser, but the browser doesn't show anything. I'm editing the InAppBrowser.cs code from cordovalib and I added the following lines before calling browser.Navigate(loc);</p>
  
  <pre><code>private void ShowInAppBrowser(string url)
  {
      IsolatedStorageFile store = IsolatedStorageFile.GetUserStoreForApplication();
      FileStream stream = store.OpenFile("test.pdf", FileMode.Create);
      BinaryWriter writer = new BinaryWriter(stream);
      var myvar = Base64Decode("the big data url");
      writer.Write(myvar);
      writer.Close();
  
      if (store.FileExists("test.pdf")) // Check if file exists
      {
          Uri loc = new Uri("test.pdf", UriKind.Relative);
          ...
      }
  }
  </code></pre>
  
  <p>This code is returning the following error: 
  Log:"Error in error callback: InAppBrowser1921408518 = TypeError: Unable to get value of the property 'url': object is null or undefined"</p>
  
  <p>I don’t wanna use ComponentOne.</p>
  
  <p>Any help would be greatly appreciated!</p>