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 9232589
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T06:21:00+00:00 2026-06-18T06:21:00+00:00

I have a widget that’s loaded as an iframe. It has to know some

  • 0

I have a widget that’s loaded as an iframe. It has to know some data about the hosting page.
I have several UTF-8 strings obtained from the page. Normally they are some lines of Russian text. The page itself is OK with proper HTML5 doctype and meta charset specification.

Then my code works like that:

params = "x1=" + encodeURIComponent(s1) + "&x2=" + encodeURIComponent(s2)
url = "http://mysite.com/iframe.html#" + params

create_iframe(url)

where create_iframe is kind of

var $if, doc;

$if = $('<iframe>').attr({
  frameborder: 0,
  scrolling: "no",
  allowtransparency: "true"
}).css(css).appendTo($cont);

doc = $if[0].contentWindow.document;

doc.open().write("<head><meta charset=\"UTF-8\"><script>" +
    "var s = \"" + url + "\";" + // <--- here the url is injected into the iframe content
    "function init() { document.location.href = s; }" + 
     "</script></head><body onload=\"init();\">...</body>");

doc.close();

Here we use jQuery to create an iframe and then write to its content to make it load our url.

Finally when the “http://mysite.com/iframe.html” URL is loaded inside of the iframe, the script inside of it gets the params’ values from the hash:

var hash_index, loc, param, params, params_array, params_string, tmp, _i, _len;

loc = document.location.href;

hash_index = loc.indexOf('#');

if (hash_index >= 0) {
  params_string = loc.substring(hash_index + 1);
}

params_array = params_string ? params_string.split('&') : [];

params = {};

for (_i = 0, _len = params_array.length; _i < _len; _i++) {
  param = params_array[_i];
  tmp = param.split('=');
  params[tmp[0]] = decodeURIComponent(tmp[1]);
}

return params;

This whole thing is working OK in Chrome.

In IE8 I get an error saying the’s invalid encoding when trying to decode the URI

How should I fix this?

  • 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-18T06:21:01+00:00Added an answer on June 18, 2026 at 6:21 am

    The answer is – IE is truncating too long URL and it happens between 2 UTF-8 bytes.

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

Sidebar

Related Questions

I have a widget that shows some data fetched from the Internet. I may
I have a jquery widget that get data from a server in another domain
I have a home-screen widget that has an icon that starts/so pose to bring
I have a widget that displays the picture of some of my contacts and
I have home screen widget that shows images. Images are switching for some scenario.
I have a sidebar widget that has an image background. Over this is a
I have a widget that contains an iframe. The user can configure the url
I'm making a program that will have a widget that has to be fixed
I have a widget MyTable that contains a QTableWidget *table . This QTableWidget has
I have a widget that has many links. In the routes file: map.resources :widgets,

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.