Charlie,
You are correct about the NOT using document.write. I'll go back and have a look at what methods I have 'played with' and maybe have used previously. My memory seems to be reminding me that I had adopted the practice of displaying my email address when hovered over, but by using the pseudo ::before or ::after. That way, it didn't appear in the HTML mark-up, but in the CSS where it appears as - content:"hello[AT]world[DOT]com"; that can be entered in plain text or in a modified unicode format.
In other words, the page had to viewed and the hovered text copied by hand.
However, there is a way of replacing the document.write method; it uses the insertAdjacentHTML method, which provides a means of inserting HTML and Text anywhere you select by using, e.g. - span#sOne.insertAdjacentHTML("afterend", TXT). In this case, the span#sOne tags could be placed somewhere in the text; which is most likely in a <p> tag, and the inserted TXT (the name of the variable holding the text string) would appear 'after' the </span> tag. The current <p> CSS would prevail, while there is still nothing in the <span id="sOne"></span>; they are just being used as a location marker. There many other ways of using this, but I'll have another look in the morning; it's rather late here.
Barry
---------------------------
--
Website FAQs: https://sites.rootsweb.com/~gearyfamily/rootsweb-hosted-web-sites.html
FTP FAQs: https://sites.rootsweb.com/~gearyfamily/publishing-your-sites.html
To contact the owners of this group, write to rw-website-...@googlegroups.com
---
You received this message because you are subscribed to the Google Groups "RootsWeb-Website-Help" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rw-website-he...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rw-website-help/e93913e4-008a-4d9d-99da-91a4d66b4c48%40superaje.com.
and calls: document.write("<ul class=\"slimmenu\">"); document.write("<li><a href=\"http:\/\/kykinfolk.com\/nelson\/index.html\">Home<\/a><\/li>"); document.write("<li><a href=\"http:\/\/kykinfolk.com\/nelson\/ndxPeople.html\">People<\/a><\/li>"); document.write("<li><a href=\"http:\/\/kykinfolk.com\/nelson\/ndxPlaces.html\">Places<\/a><\/li>"); document.write("<li><a href=\"http:\/\/kykinfolk.com\/nelson\/ndxMisc.html\">More<\/a><\/li>"); document.write("<li><a href=\"http:\/\/kykinfolk.com\/nelson\/index.html#search\">Search<\/a><\/li>"); document.write("<\/ul>"); AFAIK, it works just fine, and allows me to edit the navigation menu easily as new items are added or old items are updated. That said, I am always learning some new hiccup in CSS that may use or even needs a hack. Please tell me that document.write works for everyone in the way I have used it. Pat Asher
--
Website FAQs: https://sites.rootsweb.com/~gearyfamily/rootsweb-hosted-web-sites.html
FTP FAQs: https://sites.rootsweb.com/~gearyfamily/publishing-your-sites.html
To contact the owners of this group, write to rw-website-...@googlegroups.com
---
You received this message because you are subscribed to the Google Groups "RootsWeb-Website-Help" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rw-website-he...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rw-website-help/bf2fffda-761f-42e7-b21c-899aa7797231%40att.net.
To view this discussion on the web visit https://groups.google.com/d/msgid/rw-website-help/401371ce-516d-4338-ab9e-6b158d4122ef%40superaje.com.
LOL LOL LOL
“The only part of that phrase I understand is "attacks", which can't be a good thing.”
To view this discussion on the web visit https://groups.google.com/d/msgid/rw-website-help/401371ce-516d-4338-ab9e-6b158d4122ef%40superaje.com.
Charles, If i understand the web security issue raised by your link, it would apply to websites where the site visitor was allowed to generate content via a javascript-- which is not the case when using document.write to generate specific html as defined in a particular script, i.e. inclnavMenu.js.
But that is the beauty of this list, we can discuss and (hopefully) find a definitive answer to questions for which the answer is not always obvious.
Pat
On 9/7/2024 6:09 PM, Charles Dobie wrote:
Warning: Use of the
document.write()
method is strongly discouraged.As the HTML spec itself warns:
This method has very idiosyncratic behavior. In some cases, this method can affect the state of the HTML parser while the parser is running, resulting in a DOM that does not correspond to the source of the document (e.g. if the string written is the string "
<plaintext>
" or "<!--
"). In other cases, the call can clear the current page first, as ifdocument.open()
had been called. In yet more cases, the method is simply ignored, or throws an exception. Users agents are explicitly allowed to avoid executingscript
elements inserted via this method. And to make matters even worse, the exact behavior of this method can in some cases be dependent on network latency, which can lead to failures that are very hard to debug. For all these reasons, use of this method is strongly discouraged. Therefore, avoid usingdocument.write()
— and if possible, update any existing code that is still using it.
To view this discussion on the web visit https://groups.google.com/d/msgid/rw-website-help/401371ce-516d-4338-ab9e-6b158d4122ef%40superaje.com.
-- God is Great Beer is good Liberals are crazy!
To view this discussion on the web visit https://groups.google.com/d/msgid/rw-website-help/c7a1a1b6-473f-44e1-b701-f8dd79b0db6c%40kctu.com.
Charlie,
On the subject of 'hover doesn't
work on touch screens', I went back and had a look again at
https://ngamotu.nz/olympics/ and found that I had made the link
to my email address clickable (only once) and it would display
for 8 seconds, though attempting to copy it proved to be
fruitless. Thereafter, those using a cursor could still view it,
but would need to copy it manually. As I earlier promised, I
need to go back and make the header of that table 'sticky' and
the viewport size the control factor for scrolling. That way it
will work properly in mobiles.
I'm attaching a .txt file, which
will be easier to view in a good text-editor if saved as a .js
file, i.e. some color differentiation.
It shows a copy of the .js file
I've used, though with a dummy email address etc.. , while there
is a fairly long Note in it detailing what each part does.
Barry
-------------------
Barry,
OK, thanks -- I figured you'd find a way. I'm surprised that 'they' haven't provided a secure way of presenting email addresses which will hide the actual text from robots.
Remember that 'hover' doesn't work on touch screens.
It's morning here -- we're off to the local farmers' market in the pouring rain. Oh, what fun!
Charlie.
To view this discussion on the web visit https://groups.google.com/d/msgid/rw-website-help/591a201c-f553-47ee-9110-cea249423a2e%40gmail.com.
document.write
writes to the
document stream. Calling document.write
on a closed (or
loaded) document automatically calls document.open
which will clear
the document.
document.write()
has two
henchmen, document.open()
, and document.close()
. When the
HTML document is loading, the document is "open". When
the document has finished loading, the document has "closed".
Using document.write()
at this point
will erase your entire (closed) HTML document and replace it with
a new (open) document. This means your webpage has erased itself
and started writing a new page - from scratch."
IOW, I am using document.write to insert HTML in the page as it opens/loads. Whereas your use of document.write to "do" something AFTER the page has loaded causes it to close then reload.
Anybody know if I'm right, or if I still need to worry.
Pat
To view this discussion on the web visit https://groups.google.com/d/msgid/rw-website-help/558ca23e-6784-4ca1-a405-3389df36abe2%40superaje.com.
Pat and others;
I've had a look at what has been
happening with browser rendering of the document.write()
function, and found that if the script holding the function is
placed in the head of the page, or is available prior to the
completion of loading, the function will be honored. I found
references to Chrome not allowing document.write() to operate
post loading since ver. 55. I've tried running a post load
script in Firefox and it didn't work.
Many years ago, I created pages full of inline document.write() scripts mainly to do with navigation, and yes, they still run Okay.
For those interested, here is a page giving a simple demonstration of the insertAdjacentHTML method.
https://ngamotu.nz/test/add-html-text.html
Barry
-----------------
To view this discussion on the web visit https://groups.google.com/d/msgid/rw-website-help/194eccc6-54bf-4c7b-a2c3-758a0aad6aa2%40att.net.
To view this discussion on the web visit https://groups.google.com/d/msgid/rw-website-help/0dde0f12-6817-4b38-9689-dafc1e3fbbfc%40att.net.
Pat, I was not laughing at the situation, just the words Charles used.
To view this discussion on the web visit https://groups.google.com/d/msgid/rw-website-help/194eccc6-54bf-4c7b-a2c3-758a0aad6aa2%40att.net.