Page 1 of 1

View page source

Posted: 2018-02-08, 21:29
by dodona
did anybody beside me experiences, that 'View page source' fails, .ie just opening an empty browser tab?
Try out http://spacewar.oversigma.com/ or this forum page.

Re: View page source

Posted: 2018-02-08, 22:24
by Isengrim
The source shows just fine for me on 2018.02.02 (Windows 7 x64).

Code: Select all

<html>
<head>
<title>Spacewar! - Original 1962 code on PDP-1 emulator</title>
<meta name="keywords" content="Spacewar, game, original, PDP-1, emulator, gerasimov, silverman, Graetz, Russell, Wiitanen">
<meta http-equiv="X-UA-Compatible" content="IE=9" />
<style type="text/css">@import "spacewar.css";</style>
<script type="text/javascript" src="spacewar.js"></script>
<script type="text/javascript" src="spacewar.bin.js"></script>
<script type="text/javascript">
  if (!document.createElement('canvas').getContext) {
    window.location = "nocanvas.html";
  }
</script>
</head>

<body onload="setup();">
<h1><font face="Arial"><font size="5">Spacewar!</font><br>
<font size="3">Original 1962 game code running on a PDP-1 emulator in JavaScript</font></font></h1>
<h1><a href = "readme.html"><font face="Arial" size="3">Readme</font></a></h1><p>
<div class="frame" id="frame">
<div class="spacewar">
<canvas class="spacewar" id="swcanvas"></canvas>
</div>
</div>
</body>
</html>
I also get an error in the console:

Code: Select all

The character encoding of the HTML document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the page must be declared in the document or in the transfer protocol.
Edit: The source code for the forum also displays fine for me.

Re: View page source

Posted: 2018-03-20, 14:55
by kjpetrie
These two pages both work for me. However, there does seem to be something odd about PM's View Page source function in that it appears, instead of displaying the source of the page being viewed, to attempt to load the page again, producing timeout errors if the page has expired or downloading the page from the server without sending the cookies, resulting in a log-in message instead of the content being displayed.

This is playing havoc for me at present because I'm trying to debug a server-side script in PM and when trying to view raw page code (in order to preserve non-html formatting) am instead getting messages asking me whether I want to repeat the submission of data, which, of course will disrupt the process I'm trying to debug.

The message in the Titlebar of the Source window says it all.
Screenshot_20180320_143923.png
View source should just display the current page as plain text without parsing it or worrying about expiry. Unfortunately, it seems to be trying to undertaker some sort of re-fetching, which means it could be displaying different data from the page being viewed, which is clearly not the desired function.

Re: View page source

Posted: 2018-03-23, 14:32
by adesh
If you want to view the page as it is currently being displayed, use the "Inspect Element" function. That would give you real-time view of the web page.

Re: View page source

Posted: 2018-03-24, 09:57
by Moonchild
View page source DOES (or certainly SHOULD) display the currently-loaded page and does not re-fetch it from the web.
If it does, then something is odd in your configuration (e.g. disabled caching or similar?). Also, re-fetching may possibly occur if it's been a long time since you pulled up the original page and cache expiry happened in the meantime.