What does this mean: “[removed]('<scr'+'ipt… ”?

前端 未结 6 1630
一向
一向 2020-12-03 07:25

I\'ve seen this on every Yahoo! news page, at the bottom of the source code,
and failed to understand why they break the script word like that.
<

6条回答
  •  醉话见心
    2020-12-03 08:05

    Suppose you are writing a tool that detects the beginning and end of script blocks in a chunk of text. Suppose you see

    ")
    
    print("
    
    
    

    Without knowing the syntax of the script language, how does your tool know that this is ONE script block and not TWO script blocks with ")blah between them?

    A web browser is such a tool. It's a reasonable practice to make sure you never confuse the web browser by never having in your file unless it actually is a script tag.

提交回复
热议问题