Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #40100

Browser-dependent JavaScript problem

Newsgroups comp.lang.javascript
Date 2021-05-23 08:58 -0700
Message-ID <c759d589-5290-4bfb-b3bd-588c6799fb11n@googlegroups.com> (permalink)
Subject Browser-dependent JavaScript problem
From John Stockton <dr.j.r.stockton@gmail.com>

Show all headers | View raw


I have not been able to access this newsgroup for a while.


The following code was written in Firefox, and works there; it is called in a script element which immediately follows <BODY>.
it puts something like
          × FREDERIC.HTM - saved @ LCT 2021-05-22 Sat ×
in the bottom right-hand corner of the window.

But it does not work in Chrome, Vivaldi, Opera, AVG Secure Browser, or Edge. 
 In IE11, the style setting has no effect, and the unadorned string appears top right.  OS is Windows 10.

The style line will probably be wrapped in transmission.
For test purposes, replace YMDDstr with toString or remove .YMDDstr() !
NPR means NON-PRINT - 


function Show_Age() { // Needs INC-DATE.JS or do not use YMDDstr
  var ND = new Date(), LM = new Date(document.lastModified)
  if ((ND-LM) > 1500 && +LM > 1e12) {
    var El = document.createElement("div")
    El.style = "bottom: 0px; right: 0px; position: fixed; background: silver; width: auto; text-align: center; border-radius: 1ex; padding: 0.3ex 1.2ex; font-family: sans-serif;"
    El.className = "NPR"		// assumes styles-a.css
    El.appendChild(document.createTextNode("\xD7 " + 
    location.pathname.replace(/.*\//, "").toUpperCase() + 
      " - saved @ LCT " + LM.YMDDstr() + " \xD7"))
    El.onclick = function() { this.style.display = "none" }
    }
  document.body.appendChild(El) }

Any suggestions?

-- 
  (c) John Stockton, near London, UK.  Using Google Groups.           |
 Mail: J.R.""""""""@physics.org - or as Reply-To, if any.             |

Back to comp.lang.javascript | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Browser-dependent JavaScript problem John Stockton <dr.j.r.stockton@gmail.com> - 2021-05-23 08:58 -0700
  Re: Browser-dependent JavaScript problem Andrew Poulos <ap_prog@hotmail.com> - 2021-05-24 07:47 +1000

csiph-web