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

javascript

#1

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


List of project ideas for Google Summer of Code 2016
HTML mode with email integration
(Kane York) #2

The patch should be added here:


Perhaps `params.key?(:noscript)


#3

I changed the line to

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?


(Jeff Atwood) #4

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


(Kane York) #5

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


#6

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.


(Sam Saffron) #7

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


(Erlend Sogge Heggen) #8

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.


(Robin Ward) #9

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


#10

But that’s also without stylesheet: Add a get-option to enable noscript view of a page?escaped_fragment

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


(Kane York) #11

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.


(Robin Ward) #12

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.


#13

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


(Jeff Atwood) #14

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.


(John Muhl) #15

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.


(cpradio) #16

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


(John Muhl) #17

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).


#19

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

#20

[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:

-> Search results for 'something' - Discourse Metaescaped_fragment


(YOU) #21

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

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