最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Safari Web Inspector - Long string values truncated - Stack Overflow

programmeradmin0浏览0评论

In Safari (9.1), I am looking at a long string value (should be about 500 characters), but only shows me the first hundred or so followed by "...".

I think it's just a local setting because I have another machine running safari and I can see more on it. I can't find it nor anything in the Google.

Thanks!

In Safari (9.1), I am looking at a long string value (should be about 500 characters), but only shows me the first hundred or so followed by "...".

I think it's just a local setting because I have another machine running safari and I can see more on it. I can't find it nor anything in the Google.

Thanks!

Share Improve this question asked Mar 29, 2016 at 16:51 danielcdanielc 5397 silver badges20 bronze badges 2
  • 3 I work around this by right clicking on the variable and selecting LOG VALUE. This writes the value to the console log. – danielc Commented Apr 20, 2016 at 21:56
  • 2 I am not able to find LOG VALUE option on right click in safari – Muhammad Awais Commented Sep 16, 2019 at 12:40
Add a comment  | 

4 Answers 4

Reset to default 16

I had the same problem with Safari 13.0.2 where the log messages were cut short. But it only cuts messages if the message is not the first argument of the log function:

console.log('first log string', 'second log string')

The first argument will not (never?) be shortened. The second however will be truncated to about a 100 characters.

So if you have access to the code which does the logging, put everything inside the first argument and you should see the whole messages.

console.log('first log string' + 'second log string')

Right click on the string and select "Log value". This will print the full string to the console.

I was also having the same issue in safari, my array size was upto 2lakh and safari was only showing first 99 indexes. But my target was first 512 indexes so I used console.log(JSON.stringify(myArray.slice(0, 512)));

If you log the value to console or copy it (Cmd-C or using right-click context menu), it will not be truncated.

In many places, Web Inspector needs to truncate values at some point so that the user interface remains, well, "usable" for sites with lots of long strings or few line breaks.

发布评论

评论列表(0)

  1. 暂无评论