Skip to content

New metablock @filetype #211

@sjehuda

Description

@sjehuda

I think it would be most appropriate to incorporate the capability of the program Open in Browser into metablocks as follows:

// @filetype text/xml text/html
// @filetype application/xml text/html
// @filetype application/rss+xml text/html
// @filetype application/atom+xml text/html

@filetype: @mimetype would be good too
text/html: text/plain would be good too

About

This is a request to add new API to GM.xmlHttpRequest, or to the core of the Greasemonkey extension, that can influence a change in document.contentType.

Preface

I have wrote a userscript that converts structured data files (i.e. XML and JSON) into human readable HTML files.

Overhaul, the program works as expected; documents are processed and forged successfully into HTML.

All the extra functionalities work well when document.contentType (read only) does not contain xml.

However, when document.contentType has xml, any code that contains querySelector would fail because the document is believed to be whatever document.contentType has determined upon initial request (an XML file), and, apparently, the web browser doesn't check document once it has been loaded.

An error message from the program suggests the file processed is XML when in reality it is an HTML, hence hinders other functions to be executed:

Expected Behavior

Execute actions on document as as HTML.

Actual Behavior

Browser blocks HTML actions (throws errors) because it is believed to be an XML.

Script

https://greasyfork.org/en/scripts/465932-newspaper-native-rss-reader

Test Page

https://lzone.de/liferea/blog/feed.xml application/xml

Note

More information at greasemonkey/greasemonkey#3164

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions