Refused to set unsafe header "Content-length" in Chrome ?

3,197 views
Skip to first unread message

maveri...@gmail.com

unread,
Apr 27, 2015, 7:18:40 AM4/27/15
to jsre...@googlegroups.com
Hi,

When I try to render host pdf file in a div in my page like this

jsreport.render($("#pdfReport"), template)



I get following error in chrome
Refused to set unsafe header "Content-length"

But if I just open it in a new page 
jsreport.render(template)

, then it works fine.

Could you please help me to how to host the pdf in my div on a page in Chrome ?

Thanks,
Maverick

Jan Blaha

unread,
Apr 27, 2015, 12:16:40 PM4/27/15
to jsre...@googlegroups.com
Ouch. This is something new in chrome.

The error message can be fixed by removing Content-Length header here

However even afterwards pdf is not displayed by chrome. I need to search more what are the options for pdf in chrome.

Jan Blaha

unread,
Apr 27, 2015, 1:06:17 PM4/27/15
to jsre...@googlegroups.com
Ok, so according to this link it is a bug in google chrome introduced in version 42 and fixed just today.
I will remove the Content-Length header and wait for google chrome next hotfix.

maveri...@gmail.com

unread,
Apr 27, 2015, 1:24:18 PM4/27/15
to jsre...@googlegroups.com
Ok, thanks for your response.
Its also not working in IE and Firefox , does JSReport supports these browsers ?

And one more thing in the documentation (http://jsreport.net/learn/embedding)  it is mentioned jsreport will call jsreportInit() function , but in my case its never get called. And my jsreport always have "
  1. loaded: false ". why ?


Thanks,

Maverick


maveri...@gmail.com

unread,
Apr 27, 2015, 1:51:01 PM4/27/15
to jsre...@googlegroups.com
Jan ,

I see JSReport playground is still functional and working fine under latest chrome update, so if I want to achieve the same but using my own application UI, how can I do this ?
Are you not using jsreport.render API in playground ?

Thanks,
Maverick

Jan Blaha

unread,
Apr 27, 2015, 2:02:02 PM4/27/15
to jsre...@googlegroups.com
playground as well as standard jsreport studio is doing regular http post into an iframe what works fine across the browser. 
The approach is quite straight forward. You should be able to do it on your own. Just take the function out and change target to your iframe name here

I need to check what has changed and why render into div/object doesn't work anymore. It was working in all browsers not long time ago and it needs to work so I should fix it.

maveri...@gmail.com

unread,
Apr 28, 2015, 3:17:24 AM4/28/15
to jsre...@googlegroups.com
Thanks Jan for your suggestion , I replaced it with iframe and now its working.
I have a question that why my jsreport.loaded false ? and when is 'jsreportInit()' called and it will be used for custom application level initialization or it has some special purpose ?

And I am using
node-inspector for debugging , but my breakpoints (in embed.js)  are never got hit , do you have any idea what could be the reason ?

Thanks again for this wonderful product, your support and time.

Maverick

Jan Blaha

unread,
Apr 28, 2015, 5:03:20 AM4/28/15
to jsre...@googlegroups.com
1. jsreport.loaded is an internal property specifying if iframe with embedded editor was already loaded, it is used when you call openEditor function only, so it is OK when it is false when call just render
2. jsreportInit signalizes when jsreport object is available in DOM. It is convenient to use when you link embed.js script in async fashion. Right now there is probably no reason to use it when you link embed.js in head, but this can be changed in the future.
3. degugging of embed.js is working in my chrome, isn't node-debugging just for server side scripts? embed.js is client side



Reply all
Reply to author
Forward
0 new messages