view-source

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

Moderator: Neosoft Support

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

view-source

Post by fkapnist »

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
Gaev
Posts: 3782
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada
Contact:

Re: view-source

Post by Gaev »

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

Code: Select all

"

or

InternetGet "[Webbrowser1Addr]" "[Result]"
User avatar
fkapnist
Posts: 348
Joined: Mon Nov 17, 2014 4:24 pm
Location: Greece
Contact:

Re: view-source

Post by fkapnist »

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: Select all

"

or

InternetGet "[Webbrowser1Addr]" "[Result]"[/quote]

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

[b]InternetGet "[WebBrowser1Addr]" "[Result]" ""[/b]

It produces error message: [b]"the parameter is incorrect."[/b]

But this does work:
[b]
BrowserExport "WebBrowser1" "[Code]"[/b]

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

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

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

Re: view-source

Post by fkapnist »

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
Gaev
Posts: 3782
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada
Contact:

Re: view-source

Post by Gaev »

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
fkapnist
Posts: 348
Joined: Mon Nov 17, 2014 4:24 pm
Location: Greece
Contact:

Re: view-source

Post by fkapnist »

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
Gaev
Posts: 3782
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada
Contact:

Re: view-source

Post by Gaev »

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
fkapnist
Posts: 348
Joined: Mon Nov 17, 2014 4:24 pm
Location: Greece
Contact:

Re: view-source

Post by fkapnist »

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