Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8347369
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T07:20:37+00:00 2026-06-09T07:20:37+00:00

I’m having a problem with a page that works fine by itself, but when

  • 0

I’m having a problem with a page that works fine by itself, but when it’s embedded in a iFrame in a corporate webpage (that I don’t control) it chokes in IE9 (but not IE8).

The page uses jQuery to make an AJAX call and KnockoutJS to bind content for display. The page passes parameters in a GET request to my server with responds with AJAX, and it seems that it chokes when getting the data back from the server. The data is correct and correctly formatted, however, when this code executes:

$.ajax({
    url: this.serviceURL + parameters,
    dataType: 'json',
    success: callback,
    timeout: 3000,
    error: function (jqXHR, status, errorThrown) {
        if (status == "timeout") {
            error("The connection to the server timed out.\nEither the server is down or the network is slow.\nPlease try again later.");
        }
        else {
            error("An error occurred while trying to communicate with the server.\n " + errorThrown);
        }
    }
});

In IE9, I always hit the “An error occurred…” branch with the errorThrown of “SyntaxError: Invalid character”, which tells me nothing.

Anybody got any suggestions on how to go about debugging this problem? I used Fiddler to look at what was being sent to and returned by the server, and everything looks fine on that end.

Update: After sleeping on it for a while, I started fresh today. What I’ve determined is that for some reason, when my page is iFramed, instead of getting the JSON response:

"{"Foo":true,"Bar":true}"

I’m actually getting (from forcing an error in the error handler so I could inspect the state of the jqXHR.responseText) is:

" {"Foo":true,"Bar":true}"

Which if, using the console, I try feeding to JSON.parse, gives me an error. So the question is, where the heck is that leading space coming from? If I run this in Firefox, I see the correct response from the server (no space) and if I run this outside of the iFrame, I see no leading space. So I don’t think it’s coming server side. Somewhere in the mess of JS running on the parent page and my page, it’s inserting a leading space.

Update 2: A closer examination reveals that jqXHR.responseText.charCodeAt(0) is 65279, so it’s not actually a space (although it displays as one) it is the byte order mark. But why is it there now (and not before) and why is it causing a problem?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T07:20:38+00:00Added an answer on June 9, 2026 at 7:20 am

    I couldn’t figure out the reason for this problem, so I hacked my way around it by adding a custom converter to my ajax call. So I now have this:

            $.ajax({
                url: this.serviceURL + parameters,
                dataType: 'json',
                success: callback,
                timeout: 3000,
                converters: { "text json": HackyJSONConverter },
                error: function (jqXHR, status, errorThrown) {
                    if (status == "timeout") {
                        //alert("Timed out");
                        error("The connection to the server timed out.\nEither the server is down or the network is slow.\nPlease try again later.");
                    }
                    else {
                        error("An error occurred while trying to communicate with the server.\n " + errorThrown);
                    }
                }
            });
    

    And my hacky converter looks like this:

        function HackyJSONConverter(data) {
            if (data[0] = 65279) {
                // leading BOM - happens only with an iFrame in OT for some unknown reason
                data = data.substring(1);
            }
            return JSON.parse(data);
        }
    

    It’s immensely stupid, and I would be delighted if anybody has a better way!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I want to count how many characters a certain string has in PHP, but
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I am doing a simple coin flipping experiment for class that involves flipping a
We're building an app, our first using Rails 3, and we're having to build

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.