• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

HTML javascript - Unable to retrieve text value from src=http

Noid

Platinum Member
I didn't see a insert BB code for the threads so I will cut and paste.

This is a Online status indicator.
It sends an image ( using template=pixel )
or
Text

The text is different depending on the browser.

I been going in circles for a few days now ... trying to capture the text returned into a variable.
within the same html page this link is in ... for some simple html coding. ( I'm a n00b )
( you can see the text when you click this )

I'm also having a javascript script problem.
Seems HTML with javascript alone won't allow output to a separate notepad.txt file.
So, can 'document.write' append output ( create a 'text.html' if needed ) to a html file?
(I'm going o be looping using 'refresh' appending each time. )

This is not server side. I want this to work on my PC.

Can some .NET or C++ coding work? Should I research in this direction?
I don't want it to require a SQL package.

I need it to work for anyone.
I will gladly share my final product.

</head>
<! _______________________________________________________________________________________ />
<! />
<! If ypu put this link in your browser address bar .... />
<! />
<! http://www.noop.org/onli...site=jsm&template=text />
<! />
<! ... returns the following in address bar and text on screen />
<! />
<! FireFox returns these values />
<! />
<! static.awempire.com/status/pixel/offline.gif />
<! static.awempire.com/status/pixel/online.gif />
<! static.awempire.com/status/pixel/membersonly.gif />
<! static.awempire.com/status/pixel/private.gif />
<! />
<! />
<! Internet explorer returns these values />
<! />
<! 0 - offline />
<! 1 - online />
<! 2 - members only />
<! 3 - in private />
<! _______________________________________________________________________________________ />
<! >
<body>
<div id="2" >

<a id="3" href="http://www.noop.org/onli...site=jsm&template=text">test</a>
<br>
<img id="0" src="http://www.noop.org/onli...ite=jsm&template=pixel"></img>

Thanks in advance.

Edited for content.
--Markbnj, Programming mod
 
No, you can't write a client-side HTML file from javascript in the browser. That would be a big security risk, so it just isn't possible. You would need an ActiveX control of some kind, which will probably cause more issues than it's worth.

I'm going to edit your sample links. We're not prudes or anything, but in a programming forum there's no sense having content that might trigger someone's work filters.
 
Thank you. I forgot about 'work safe'.

What about retrieving the text into a javascript variable?
 
Sounds like you want to:

1. Have a page of your own that checks another page's text, and
2. Repeatedly append that page's status onto your own page.

(1) can be done with AJAX. The XMLHttpRequest method doesn't really require XML; it will take anything, including HTML or text. Then you just have to parse it.
(2) I believe can be done in several ways. Check my example page for one way to append text onto one's own page.
 
They are both his pages, right? IIRC, AJAX has same-domain requirements.


Actually, getting the text itself shouldn't be difficult at all. Wrap the link in a div with an id, get the div, the firstChild().innerHTML.


For the second part, I'm not sure exactly what you're trying to accomplish. You can certainly create a new HTML page from javascript, and use document.write to create it. You can't force it to save, or anything like that, and the user can always close it. But without knowing what, exactly, you're trying to accomplish here, it's hard to help.
 
Imagine, if you would, a phishing page that isn't constrained by that kind of restrictions. Not only can you steal passwords, but you can immediately verify them immediately with an AJAX request.
 
Back
Top