# Add a get-option to enable noscript view of a page

**URL:** https://meta.discourse.org/t/add-a-get-option-to-enable-noscript-view-of-a-page/33823
**Category:** Feature
**Created:** [2015 年 9 月 28 日午前 7:20 UTC](https://meta.discourse.org/t/add-a-get-option-to-enable-noscript-view-of-a-page/33823 "2015-09-28T07:20:12Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![rubo77](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rubo77/32/41019_2.png) [@rubo77](https://meta.discourse.org/u/rubo77)
#### Post date: [2015 年 9 月 28 日午前 7:20 UTC](https://meta.discourse.org/t/add-a-get-option-to-enable-noscript-view-of-a-page/33823/1 "2015-09-28T07:20:13Z")

</div>

If you watch a discourse forum with javascript disabled, you get a read-only view of that page.

could you add a link to the read-only view at the bottom? so you can for example print the whole page or translate it with google,…

also a functioning noscript view of a search result should be easy to implement with this option. At the moment it doesn’t work without js like this:  
[https://meta.discourse.org/search?q=something](https://meta.discourse.org/search?q=something)

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [2015 年 9 月 29 日午前 5:41 UTC](https://meta.discourse.org/t/add-a-get-option-to-enable-noscript-view-of-a-page/33823/2 "2015-09-29T05:41:54Z")

</div>

The patch should be added here:

> <https://github.com/discourse/discourse/blob/3620c8c85e034dc770c0311f35e902e87a857fe8/app/controllers/application_controller.rb#L54>

* * *

Perhaps `params.key?(:noscript)

---

<div class="post-metadata">

### Author: ![rubo77](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rubo77/32/41019_2.png) [@rubo77](https://meta.discourse.org/u/rubo77)
#### Post date: [2015 年 10 月 12 日午後 10:37 UTC](https://meta.discourse.org/t/add-a-get-option-to-enable-noscript-view-of-a-page/33823/3 "2015-10-12T22:37:06Z")

</div>

> [@riking](#):
>
> Perhaps `params.key?(:noscript)

I changed the line to

```plaintext
def use_crawler_layout? 
  @use_crawler_layout ||= (has_escaped_fragment? || params.key?(:noscript) || CrawlerDetection.crawler?(request.user_agent))
end

```

And this seems to work, if I add `?noscript=1` to any site, I get the crawler-view, but the stylesheet is not included there, I guess there has to be changed somethhing in the layout too?

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [2015 年 10 月 13 日午前 1:29 UTC](https://meta.discourse.org/t/add-a-get-option-to-enable-noscript-view-of-a-page/33823/4 "2015-10-13T01:29:15Z")

</div>

Why would you need this? Just set the user agent in your browser as required.

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [2015 年 10 月 13 日午前 1:41 UTC](https://meta.discourse.org/t/add-a-get-option-to-enable-noscript-view-of-a-page/33823/5 "2015-10-13T01:41:40Z")

</div>

We could build an AMP view of the topic page for quick loading for first-time, anonymous visitors.

---

<div class="post-metadata">

### Author: ![rubo77](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rubo77/32/41019_2.png) [@rubo77](https://meta.discourse.org/u/rubo77)
#### Post date: [2015 年 10 月 13 日午前 7:51 UTC](https://meta.discourse.org/t/add-a-get-option-to-enable-noscript-view-of-a-page/33823/6 "2015-10-13T07:51:27Z")

</div>

> [@riking](#):
>
> AMP

I guess you refer to Google Accelerated Mobile Pages, to accelerate content loading on mobile devices.  
I think that’s another issue.

My point here is to make sites like Google translate work with discourse by adding a parameter not to use JavaScript.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2015 年 10 月 13 日午前 7:54 UTC](https://meta.discourse.org/t/add-a-get-option-to-enable-noscript-view-of-a-page/33823/7 "2015-10-13T07:54:30Z")

</div>

Don’t see the point of amp, we already have html views, just beef them up and expose

---

<div class="post-metadata">

### Author: ![erlend\_sh](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/erlend_sh/32/119475_2.png) [@erlend\_sh](https://meta.discourse.org/u/erlend_sh)
#### Post date: [2015 年 10 月 13 日午前 8:22 UTC](https://meta.discourse.org/t/add-a-get-option-to-enable-noscript-view-of-a-page/33823/8 "2015-10-13T08:22:02Z")

</div>

Isn’t a beefed up HTML view and AMP basically the same thing? What got me excited about AMP was that it seemed like a good specification for a beefed up Discourse HTML front-end to target.

---

<div class="post-metadata">

### Author: ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)
#### Post date: [2015 年 10 月 13 日午後 3:45 UTC](https://meta.discourse.org/t/add-a-get-option-to-enable-noscript-view-of-a-page/33823/9 "2015-10-13T15:45:05Z")

</div>

There is already a param for this: `_escaped_fragment_` – just add it to any URL to get the crawlable version.

---

<div class="post-metadata">

### Author: ![rubo77](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rubo77/32/41019_2.png) [@rubo77](https://meta.discourse.org/u/rubo77)
#### Post date: [2015 年 10 月 15 日午後 10:45 UTC](https://meta.discourse.org/t/add-a-get-option-to-enable-noscript-view-of-a-page/33823/10 "2015-10-15T22:45:31Z")

</div>

But that’s also without stylesheet: [Add a get-option to enable noscript view of a page](https://meta.discourse.org/t/add-a-get-option-to-enable-noscript-view-of-a-page/33823/?_escaped_fragment_)

Try this instead: disable JavaScript and look at this page.  
It has a style and is crawlable

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [2015 年 10 月 16 日午前 3:16 UTC](https://meta.discourse.org/t/add-a-get-option-to-enable-noscript-view-of-a-page/33823/11 "2015-10-16T03:16:40Z")

</div>

I have a WIP AMP view on my machine, triggered by adding `?amp` to the URL.

It has some code quality issues which is why I haven’t shared it yet, also waiting on some pretty bad bugs to be resolved with the AMP script.

---

<div class="post-metadata">

### Author: ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)
#### Post date: [2015 年 10 月 16 日午後 6:26 UTC](https://meta.discourse.org/t/add-a-get-option-to-enable-noscript-view-of-a-page/33823/12 "2015-10-16T18:26:09Z")

</div>

Oh I see you are advocating for a basic no-JS discourse.

Your patch however does not do that of course, but the issue is not `_escaped_fragment` it’s that we’ve never programmed that functionality.

We have discussed improving the no-JS layout but it hasn’t been a priority yet. It’s designed to be crawled now which it does well.

---

<div class="post-metadata">

### Author: ![rubo77](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rubo77/32/41019_2.png) [@rubo77](https://meta.discourse.org/u/rubo77)
#### Post date: [2015 年 10 月 16 日午後 9:38 UTC](https://meta.discourse.org/t/add-a-get-option-to-enable-noscript-view-of-a-page/33823/13 "2015-10-16T21:38:45Z")

</div>

It would be so easy, to just add a link aat the bottom: “print-view” that leads to adding the `?noscript` option. I think only two lines of code have to be changed:

- the one above and
- one line (to be found) where the stylesheet will be included in case the option is set

does anybody understand the code, to tell this second lline? then the patch would be ready to be implemented

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [2015 年 10 月 16 日午後 10:35 UTC](https://meta.discourse.org/t/add-a-get-option-to-enable-noscript-view-of-a-page/33823/14 "2015-10-16T22:35:14Z")

</div>

Why do you need print links? Just do File, Print in your browser.

Not really following anything about what you are doing or requesting here.

---

<div class="post-metadata">

### Author: ![johnmuhl](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/johnmuhl/32/43413_2.png) [@johnmuhl](https://meta.discourse.org/u/johnmuhl)
#### Post date: [2015 年 10 月 17 日午前 1:34 UTC](https://meta.discourse.org/t/add-a-get-option-to-enable-noscript-view-of-a-page/33823/15 "2015-10-17T01:34:06Z")

</div>

It seems broken in Chrome stable OS X 10.9.5. Choosing File, Print pops up the dialog for about a second then, before any interaction, it disappears and nothing is printed.

---

<div class="post-metadata">

### Author: ![cpradio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cpradio/32/4970_2.png) [@cpradio](https://meta.discourse.org/u/cpradio)
#### Post date: [2015 年 10 月 17 日午前 1:35 UTC](https://meta.discourse.org/t/add-a-get-option-to-enable-noscript-view-of-a-page/33823/16 "2015-10-17T01:35:11Z")

</div>

It did that for me too, but when I do it a second time, it remains open… very weird. Chrome stable (v45) on Linux

---

<div class="post-metadata">

### Author: ![johnmuhl](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/johnmuhl/32/43413_2.png) [@johnmuhl](https://meta.discourse.org/u/johnmuhl)
#### Post date: [2015 年 10 月 17 日午前 1:37 UTC](https://meta.discourse.org/t/add-a-get-option-to-enable-noscript-view-of-a-page/33823/17 "2015-10-17T01:37:23Z")

</div>

Seems to only affected me if I’m logged in. Opening an incognito window and trying to Print seems to work. Exact Chrome version is 46.0.2490.71 (64-bit).

---

<div class="post-metadata">

### Author: ![rubo77](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rubo77/32/41019_2.png) [@rubo77](https://meta.discourse.org/u/rubo77)
#### Post date: [2015 年 10 月 17 日午前 7:27 UTC](https://meta.discourse.org/t/add-a-get-option-to-enable-noscript-view-of-a-page/33823/19 "2015-10-17T07:27:33Z")

</div>

> [@codinghorror](#):
>
> Why do you need print links? Just do File, Print in your browser.
> 
> Not really following anything about what you are doing or requesting here.

I want two things:

- a link, that I can feed into google translator that works.
- create a working search function that works, when javascript is disabled

---

<div class="post-metadata">

### Author: ![rubo77](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rubo77/32/41019_2.png) [@rubo77](https://meta.discourse.org/u/rubo77)
#### Post date: [2015 年 10 月 17 日午前 7:30 UTC](https://meta.discourse.org/t/add-a-get-option-to-enable-noscript-view-of-a-page/33823/20 "2015-10-17T07:30:04Z")

</div>

[quote=“eviltrout, post:9, topic:33823, full:true”]  
There is already a param for this: _escaped\_fragment_ – just add it to any URL to get the crawlable version.  
[/quote]his doesn’t work anyway:

→ [https://meta.discourse.org/search?q=something&\_escaped\_fragment\_](https://meta.discourse.org/search?q=something&_escaped_fragment_)

---

<div class="post-metadata">

### Author: ![YOU](https://avatars.discourse-cdn.com/v4/letter/y/43a26b/32.png) [@YOU](https://meta.discourse.org/u/YOU)
#### Post date: [2015 年 10 月 17 日午前 7:41 UTC](https://meta.discourse.org/t/add-a-get-option-to-enable-noscript-view-of-a-page/33823/21 "2015-10-17T07:41:53Z")

</div>

[quote=“rubo77, post:20, topic:33823, full:true”]

> [@eviltrout](#):
>
> There is already a param for this: _escaped\_fragment_ – just add it to any URL to get the crawlable version.  
> [/quote]his doesn’t work anyway:
> 
> → [https://meta.discourse.org/search?q=something&\_escaped\_fragment\_](https://meta.discourse.org/search?q=something&_escaped_fragment_)

search page doesn’t show anything if you disable javascript, differrent issue IMO.

[次のページ](https://meta.discourse.org/t/add-a-get-option-to-enable-noscript-view-of-a-page/33823.md?page=2)
