wiselinks icon indicating copy to clipboard operation
wiselinks copied to clipboard

Response headers X-Wiselinks-Title, X-Wiselinks-Description, etc is not processed

Open Novik opened this issue 11 years ago • 3 comments

when Wiselnks use as target a standard container (body). Reason of this is a simple: _response.js.coffee

  _extract_title: ->
    if @_is_full_document_response()
      $('title', @_get_doc()).text()
    else
      @xhr.getResponseHeader('X-Wiselinks-Title')

  _is_full_document_response: ->
    @_get_doc_target_node().length is 1

  _get_doc_target_node: ->
    @$doc_target_node ?= $(@$target.selector, @_get_doc())

  _get_doc: ->
    @_doc ?= Response._get_document_parser().parse(@html)

_get_doc always return document with a body element. As result, we have _is_full_document_response => true. Is this a really correct behavior?

Novik avatar Jul 17 '14 11:07 Novik

No, of course it is not correct.

igor-alexandrov avatar Jul 17 '14 12:07 igor-alexandrov

Workaround: add class attribute to the body tag and use corresponding selector as a target.

Спасибо за Вашу работу.

Novik avatar Jul 17 '14 12:07 Novik

With this fix i'm at least able to set the title using the header. But shouldn't the header be optional? If i don't set the header in the current version it gets set to an empty string. If i use Novik's patch it gets set to 'null'. I would expect that if i don't set the header the title should just stay.

elbarto132 avatar Oct 12 '14 12:10 elbarto132