Source language: Translate to:

view-source

Questions and information about creating Internet aware NeoBook applications. Including PHP, HTML, FTP, HTTP, Email, etc.

Moderator: Neosoft Support

view-source

Postby fkapnist » Mon Jun 06, 2016 2:43 am

If you enter :
view-source:http://www.neosoftware.com/ in the browser address bar, it works with Chrome, Firefox and Opera, but not Edge or IE11. Why is view source not allowed by Microsoft? All you get with a right click is a small "developer" window that makes it difficult to copy code. What is the easiest way with Neobook for a user to get the source code of the current page?

:?:

.
User avatar
fkapnist
 
Posts: 348
Joined: Mon Nov 17, 2014 4:24 pm
Location: Greece

Re: view-source

Postby Gaev » Mon Jun 06, 2016 5:11 am

fkapnist:
What is the easiest way with Neobook for a user to get the source code of the current page

BrowserExport "WebBrowser1" "[Code]"

or

InternetGet "[Webbrowser1Addr]" "[Result]"
User avatar
Gaev
 
Posts: 3728
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: view-source

Postby fkapnist » Tue Jun 07, 2016 12:39 am

Gaev wrote:fkapnist:
What is the easiest way with Neobook for a user to get the source code of the current page

BrowserExport "WebBrowser1" "[Code]"

or

InternetGet "[Webbrowser1Addr]" "[Result]"


Thanks Gaev. Since I am in Europe most of the pages are foreign language UTF-8 encoded.
This doesn't work at all:

InternetGet "[WebBrowser1Addr]" "[Result]" ""

It produces error message: "the parameter is incorrect."

But this does work:

BrowserExport "WebBrowser1" "[Code]"


But if I try to view the result in Neobook it struggles and takes a long time and finally displays garbled text.

However if I save it to file I can open it in Notepad

FileWrite "[PubDir]Test.txt" "All" "[Code]"

I guess I will have to create a source code reader outside of Neobook. But how?

Maybe I can do it with NeoAppBuilder HTML and display it in a Neobook webBrowser object

:?: :?:

.
User avatar
fkapnist
 
Posts: 348
Joined: Mon Nov 17, 2014 4:24 pm
Location: Greece

Re: view-source

Postby fkapnist » Tue Jun 07, 2016 1:13 am

Most browsers give you a "page details" window with an uninteresting display:

Image

I am going to include a "formatted view" like you see in Facebook and Twitter. I think that extra mile makes all the difference.

Image

:)
User avatar
fkapnist
 
Posts: 348
Joined: Mon Nov 17, 2014 4:24 pm
Location: Greece

Re: view-source

Postby Gaev » Tue Jun 07, 2016 5:35 am

fkapnist:
Since I am in Europe most of the pages are foreign language UTF-8 encoded.
This doesn't work at all:

InternetGet "[WebBrowser1Addr]" "[Result]" ""

It produces error message: "the parameter is incorrect."

Did you try ...
Code: Select all
AlertBox "WebBrowser1Addr" "[WebBrowser1Addr]"
InternetGet "[WebBrowser1Addr]" "[Result]" ""
... to see what was being messed up ?

But this does work:

BrowserExport "WebBrowser1" "[ code]"

But if I try to view the result in Neobook it struggles and takes a long time and finally displays garbled text.

... not surprising since NeoBook does NOT do UTF-8.

However if I save it to file I can open it in Notepad

FileWrite "[PubDir]Test.txt" "All" "[ code]"

I guess I will have to create a source code reader outside of Neobook. But how?

How about ...
Code: Select all
Run "[PubDir]Test.txt" "" "options" "subroutine" "variable"



In an earlier post you said ...
view-source:http://www.neosoftware.com/ in the browser address bar, it works with Chrome, Firefox and Opera, but not Edge or IE11. Why is view source not allowed by Microsoft?

I read that it was done for security reasons.

What is the easiest way with Neobook for a user to get the source code of the current page?

According to this page ... http://stackoverflow.com/questions/1367 ... m-the-page ... you might be able to use outerHTML ... so you could do a BrowserExecScript that uses outerHTML to store the content in a (javascript) variable ... followed by one of the encoding scripts discussed in an earlier topic.
User avatar
Gaev
 
Posts: 3728
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: view-source

Postby fkapnist » Tue Jun 07, 2016 7:30 am

Gaev wrote:BrowserExecScript that uses outerHTML to store the content in a (javascript) variable.


Yes, I will save the source code to a variable and then display it in a webBrowser object using javascript. But I want the source code to have different colors for particular strings like function, or style, etc.

I noticed that Neobook "BrowserExport" can store UTF-8 source code as a variable, but Neobook cannot directly display it....
User avatar
fkapnist
 
Posts: 348
Joined: Mon Nov 17, 2014 4:24 pm
Location: Greece

Re: view-source

Postby Gaev » Tue Jun 07, 2016 8:56 am

fkapnist:

But I want the source code to have different colors for particular strings like function, or style, etc.

Take a look at ... http://alexgorbatchev.com/SyntaxHighlighter/ ... demo at http://alexgorbatchev.com/SyntaxHighlig ... nual/demo/

You would run it inside an HTML document ... within a WebBrowser object or standalone Browser Tab

Good hunting.
User avatar
Gaev
 
Posts: 3728
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: view-source

Postby fkapnist » Fri Jun 24, 2016 7:42 pm

Gaev wrote:fkapnist:

But I want the source code to have different colors for particular strings like function, or style, etc.

Take a look at ... http://alexgorbatchev.com/SyntaxHighlighter/ ... demo at http://alexgorbatchev.com/SyntaxHighlig ... nual/demo/

You would run it inside an HTML document ... within a WebBrowser object or standalone Browser Tab

Good hunting.



Thanks, I finally used the gorbatchev highlighter....
User avatar
fkapnist
 
Posts: 348
Joined: Mon Nov 17, 2014 4:24 pm
Location: Greece


Return to NeoBook and the Internet

Who is online

Users browsing this forum: No registered users and 1 guest