Solution for automatically changing the IE title to the URL segment ID (# text after)

Source: Internet
Author: User
Symptoms:

When the page is embedded with flash and the address of the page contains the "fragment identifier" (text after the URL #), use IE to access the page, after the Flash file is loaded, the title of the browser window is added with the "clip ID" or the title is replaced with the "clip ID ".

Problem occurrence condition:

Software versions that are known to cause problems: IE6, Flash Player 11.0.1.152

This problem only exists in IE browser, and exists in IE6, 7, and 8.

Cause:

The test has nothing to do with the flash embedding method (it is not a problem with swfobject or other script components ).

The document. Title value may have been accidentally modified due to a bug in Flash Player of ActiveX version. The specific cause is not further analyzed.

PS: I have also found some bugs in parsing data when the Flash Player Plug-in processes script communication. So this time it will be a similar reason?

Solution:

Use an event unique to IE for processing:

(Function () {var remembertitle = document. title; // remember the original window title try {// try-catch is used for compatibility with the browser document that does not support the attachevent method. attachevent ('onpropertychang', function () {If (document. title! = Remembertitle) {// This judgment must be added, otherwise it will cause recursive call Stack Overflow document. title = remembertitle ;}});} catch (e) {// Noop} document. settitle = function (newtitle) {// use this method to replace "document. title = xxx "statement remembertitle = newtitle; document. title = newtitle ;};})();

Refer:

IE title changes to <afterhash> If the page has a URL with '#', and has flash/SWF embedded in it
-Stack Overflow

RFC 2396 4.1. Fragment identifier

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.