View Issue Details

IDProjectCategoryView StatusLast Update
0017176mantisbthtmlpublic2019-09-18 03:46
Reporterkelson Assigned Todregad  
PrioritynormalSeverityminorReproducibilityN/A
Status closedResolutionfixed 
Product Version1.2.17 
Target Version1.3.0-beta.1Fixed in Version1.3.0-beta.1 
Summary0017176: Add the possibility to define the x-ua-compatible meta
Description

Hi,

With Internet Explorer 8, without any forcing meta, the compactibility mode is IE7.
However, I would like to force the Browser to use the mode IE8.

I have check on the Internet, the following line have to be coded after the Doctype.
<meta http-equiv="X-UA-Compatible" content="IE=8">

Regards,

Additional Information

My proposal:
As a web developer, I want this compatibility mode in my plugin pages.
So maybe the best way is to use a new event.

In html_api.php, add an event after the doctype

function html_begin() {
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">', "\n";
event_signal( 'X_UA_COMPATIBLE' );
echo '<html>', "\n";
}

In the events_inc.php, define the new event constant
'X_UA_COMPATIBLE' => EVENT_TYPE_OUTPUT,

TagsNo tags attached.
Attached Files
default.png (52,115 bytes)   
default.png (52,115 bytes)   
branch html page top.png (64,070 bytes)   
branch html page top.png (64,070 bytes)   

Relationships

related to 0026156 closeddregad custom_meta_inc include disappear 

Activities

dregad

dregad

2014-04-09 10:44

developer   ~0039890

I am not sure I understand the rationale of defining a new event for this, surely you'll want the compatibility mode to apply to all of your pages consistently, not just some plugin's ?

In this case I believe it would be simpler and make more sense to simply have a custom php script to define your meta tag as appropriate, and then include it on every Mantis page using the $g_meta_include_file config_inc.php setting.

kelson

kelson

2014-04-10 04:22

reporter   ~0039898

Actually I made a mystake by writting :

I have check on the Internet, the following line has to be coded after the Doctype.
<meta http-equiv="X-UA-Compatible" content="IE=8">

<meta http-equiv="X-UA-Compatible" content="IE=8"> has to be the first element right after <head>.

function html_page_top1( $p_page_title = null ) {
html_begin();
html_head_begin();
html_css();
html_content_type();
include( config_get( 'meta_include_file' ) );
...

$g_meta_include_file is called too late. In order to work, include( config_get( 'meta_include_file' ) ) has to be after hmtl_head_begin()

dregad

dregad

2014-04-11 08:06

developer   ~0039901

I have check on the Internet

I assume you mean this: "The X-UA-Compatible header [...] must appear in the header of the webpage (the HEAD section) before all other elements except for the title element and other meta elements." (source [1])

Please test the proposed patch [2], let me know if that works with a custom $g_meta_include_file. Note that it's against master branch and may not apply cleanly on 1.2.x but the changes are quite straightforward so you should be able to figure conflicts out if you don't want to test on master.

[1] http://msdn.microsoft.com/en-us/library/jj676915%28v=vs.85%29.aspx
[2] https://github.com/dregad/mantisbt/tree/html-page-top

kelson

kelson

2014-04-11 08:39

reporter   ~0039902

I have applied changes in html_page_top1 function from your branch.
It works !

I made 2 screenshots to show the result in my case.

dregad

dregad

2014-04-11 10:01

developer   ~0039903

Last edited: 2014-04-11 10:01

Pull request for peer review https://github.com/mantisbt/mantisbt/pull/158

Thanks for testing !

Related Changesets

MantisBT: master 5299ddfd

2014-04-11 02:00

dregad


Details Diff
HTML API: revise order of elements in HEAD section

The HTML specification [1] does not specify a strict order for the
elements within the HEAD section, other than Content-Type appearing
within the first 1024 bytes of the document.

Microsoft / Internet Explorer has stricter guidelines when it comes to
defining compatibility mode [2]: "The X-UA-Compatible header [...] must
appear in the header of the webpage (the HEAD section) before all other
elements except for the title element and other meta elements."

This commit reorganizes html_page_top1() function to:
- define Content-Type as the HEAD's first element
- allow users to set X-UA-Compatible in $g_meta_include_file
- include CSS after defining the TITLE, together with other LINK tags

Fixes 0017176

[1] http://www.w3.org/TR/html5/document-metadata.html
[2] http://msdn.microsoft.com/en-us/library/jj676915%28v=vs.85%29.aspx
Affected Issues
0017176
mod - core/html_api.php Diff File