Page 3 of 8 FirstFirst 12345 ... LastLast
Results 21 to 30 of 80

Thread: Turn simple javascript code to a button

  1. #21
    Join Date
    Oct 2013
    Posts
    169
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    Update John:

    This code works on 3 different forums flawlessly on Firefox, Chrome and Safari, I still have the style sheet codes in place for it also:

    Code:
    <a href="javascript:void(0);" onclick="postimage_upload(0);" class="button">Insert Image</a>
    <script type="text/javascript" src="http://mod.postimage.org/website-english-family.js" charset="utf-8"></script>
    The "only" flaw in IE is the ajax message and I know it's applicable to IE 9 to IE11.

  2. #22
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,496
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    If using a link causes the AJAX message problem in IE, I would think the same thing would happen if you used the postimage script without any modification. Have you tested that? If not, please do.

    In any case, this AJAX message problem doesn't happen in IE on the test forum (according to you if I understood what you said before, please verify), nor on the test form I have. If so, it's a conflict with something on the forums where it does occur.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #23
    Join Date
    Oct 2013
    Posts
    169
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    Ok John I just put the last code in the test forum that you have posted on and no ajax message at all to this point. Question? I think you mentioned something about another javascript code on the same page could cause issues? I do have one on the same page with this code on the forums, but not the test forum?

    EDIT: Went and removed the other javascript code and had no change. Also in response to your question, yes if you use the link only on my 3 main forums you still get the AJAX message.

    Any thoughts of possible things that could cause this?
    Last edited by JRR; 02-24-2015 at 07:41 PM.

  4. #24
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,496
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    FYI, on a page like:

    http://thescooterprofessor.proboards.com/thread/3813/todays-ride

    There are at least 25 scripts and that's (I think) not counting those on pages in iframes on the page. Some of these scripts are obviously put there by other scripts and/or by the board software. Chrome (and I would assume FF) see no errors though, so that's probably why there's no problem there. IE however sees 4 errors:

    SCRIPT5: Access is denied.
    File: storageframe.html, Line: 1, Column: 1

    SCRIPT5: Access is denied.
    File: tb2, Line: 1, Column: 1

    SCRIPT5: Access is denied.
    File: engine, Line: 1, Column: 1

    SCRIPT5: Access is denied.
    File: 20838, Line: 1, Column: 1
    Now none of that by itself is the problem, but it does appear to be setting up the problem, and may be the only part of the problem you have direct control over.

    The real problem that I can see is that for some reason, once you upload the image in the popup window, instead of simply gracefully closing, it first loads a response url from the forum into that window. That response url (for example, the one I mention in this post) is the page that you are responding to a message on plus a query string (?postimage_id=0). If there are no errors on that page, the window closes and there is no problem. If there are errors, it can confuse the browser and make it think something hasn't finished. Or maybe the errors are irrelevant and IE is just pickier about other error free scripts that haven't finished loading at the point the window is told to close.

    The one real clue we have as to what is the problem is the fact that it appears to involve an AJAX request.

    Are there any scripts or anything that could involve any of those files mentioned that are part of something on the scooter forum that you don't have/use on the test forum?


    Just for clarity's sake, like if you're in IE and you click to stay on the page. you see in the popup a page. If you were posting to:

    http://thescooterprofessor.proboards.com/thread/3813/todays-ride

    There will be this page in the popup:

    http://thescooterprofessor.proboards.com/thread/3813/todays-ride?postimage_id=0

    You can then close it manually with no problem, so presumably the AJAX process has by that point finished.

    I'm not sure why that page had to get loaded in there, but it does in other browsers as well, so it's part of the postimage service.

    Unless they stop doing that (putting a page like that in the popup before closing it - which might be very hard without completely rewriting their code). Then all we can do to fix it is make that page fast loading and error free. Or at least have that page not involve any AJAX requests that start without user initiation.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #25
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,496
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Please read my previous post it still has merit. I wanted to add that I was able to get the error in IE on the test forum:

    http://scootproftest.freeforums.net/thread/1/welcome-new-forum

    It didn't happen all the time - probably because the page loads faster in general, but it did happen.

    So instead of being something you've added to the other forums, it's more likely some problem with the forum package itself.

    I noticed there was an error because I didn't have any personal smileys, when it went to count them, they were null or not an object. This may or may not have anything to do with it. But make sure you have them (personal smileys) and then try again.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  6. #26
    Join Date
    Oct 2013
    Posts
    169
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    I understand everything you said here and point blank this is a IE issue across the board, have tested with W7 and IE 8, 9 and 10, have people that have tested in in Vista.

    I have looked at those script errors and they are on the test forum too but again we do not have the issue on that forum. Things I have done so far to test:

    I've made sure the test forum has the exact same plugins as the other forums, turned them all off in the forums with the problem and we have no plugin causing this issue.

    I've went through every javascript code I have in the headers and the footers of the problem forums and added them to the test forum, again the issue is still not there.

    I'm in the process of going through every single section of the templates and adding any things from the problem forums to the test forum and so far I'm still not seeing it there but I haven't finished either. My thought is sooner or later I'll put something in that creates this issue and then bingo!

    I will ask my server people about the script errors to see if they can shed some light on this.

    At one time John a guy on PB had made this image post thing using the same host into a plugin, it worked for a while but PB does do updates and when it quit working the author has never came back and you have no way of knowing what was wrong in his plugin? But like a lot of plugins PB has they can be duplicated in lots of cases with header or template coding, this AJAX thing wasn't the problem with his plugin, it just quit working.

    I just keep thinking there has got to be some way to by code to tame IE? This image posting thing is a very sought after thing among me members which with 3 forums totals over 12K members.

  7. #27
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,496
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    One thing we could try is to leave or blank out the page that postimage loads into the popup as soon as possible. This could more effectively be done using PHP, that is if the the forum runs on PHP and we can insert an effective test for this early enough in the parsing of the page by the server. It could use the query string to prompt a die. But his script might also be effective. Place it as near to beginning of the head as possible:

    Code:
    <script type="text/javascript">
    if('postimage_id'.test(location.href)){location.href = 'about:blank';}
    </script>
    If it doesn't help, then leave it so I can test it.

    If using PHP we would do something like (not tested, but is valid PHP code):

    Code:
    <?php if(isset($_REQUEST['postimage_id'])){die();} ?>
    That should be the first thing the server sees when parsing the page.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  8. #28
    Join Date
    Oct 2013
    Posts
    169
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    Gave the top code a try, put it exactly where you wanted it John and another no go, arrrrgh! Could the code at the bottom with the {die();} be converted to a non php format? I really appreciate your patience and help.


    Also I didn't see what you said about it happening to you sometimes on the test forum and the personal smileys. First of all the Personal Smileys is a added plugin and one adds the smileys by going to their profile and pasting them in. I turned the plugin off so it's not a possibility now. I also have never at one time have had the Ajax pop up come up for me on that forum after doing a lot of photos, not once. Could you see if it does for you now since I've disabled the personal smileys?
    Last edited by JRR; 02-25-2015 at 07:16 PM.

  9. #29
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,496
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Still happening on the test forum, so that wasn't the error or not the only error causing the trouble. Tends to - or seems to happen with the larger (byte size) images. Certainly doesn't happen all the time. It might have more to do with bandwidth (load time of the page in the popup).

    With the script I gave (javascript one) I asked you to leave that in place, even of it didn't work. Best place for that would be the scooter forum:

    http://thescooterprofessor.proboards.com/

    where I have an account.

    There's no way to die() in anything other than PHP, and no way to do anything like that in anything that's not server side (javascript won't work) but asp and other server side languages might - depends upon whether or not the server side language you use has an equivalent for die(). What die() does when it works is stop the rest of the page from being sent to the browser.

    It's possible that even if we can get a die() type server side thing happening or even with the javascript I wrote for this, if either of those are successful in preventing the rest of the page from loading in the browser, that might also prevent the postimage script from working properly. But if it still allowed the postimage script to work, it should prevent IE from getting upset about anything on the page.

    What server side language does proboards use? I thought most did use PHP - most forums at least.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  10. #30
    Join Date
    Oct 2013
    Posts
    169
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    Sorry John I didn't see the leave the code request and I'll go back and put it in. I just got this from one of the admins at PB with what he says is the problem?


    I can duplicate the stuff happening in that thread. That's happening because the window the uploader pops up redirects to your forum before closing, then closes immediately upon loading the forum causing it to interrupt the forum's standard AJAX requests. That would ultimately be the responsibility of the designer of the Simple Image Uploader to fix.
    They don't use PHP. Proboards is coded in Perl. Previously, due to the remotely hosted nature of the service, users cannot modify the software directly as with some forum systems, but some customisation is possible through the use of CSS or JavaScript codes. With the release of v.5, however, ProBoards gives Administrators and certain other members access to the HTML and CSS of the webpage, for easier coding purposes.

    I'll get that code back in scooter professor forum. Also I don't know why but no matter what size image I use I cannot make this happen on my test forum?
    Last edited by JRR; 02-25-2015 at 10:37 PM.

Similar Threads

  1. Please write a simple javascript code for me
    By laperashvili in forum JavaScript
    Replies: 2
    Last Post: 06-18-2012, 03:10 PM
  2. adding rollover button to javascript code
    By Repatilian in forum JavaScript
    Replies: 6
    Last Post: 12-04-2011, 10:28 AM
  3. Help with javascript code to make next and previous button dissapear
    By ajmancilla in forum Looking for such a script or service
    Replies: 1
    Last Post: 02-07-2011, 03:00 PM
  4. Looking for a simple Javascript code for a web board
    By donelian in forum Looking for such a script or service
    Replies: 1
    Last Post: 08-15-2007, 10:24 PM
  5. How to turn a menu into a javascript file?
    By Eternal_Howl in forum JavaScript
    Replies: 4
    Last Post: 07-23-2007, 07:16 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •