Advanced Search

Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: help with Arie's script

  1. #1
    Join Date
    Jan 2011
    Location
    Southeastern CT
    Posts
    586
    Thanks
    41
    Thanked 27 Times in 27 Posts

    Default help with Arie's script

    I started with this:
    http://fofwebdesign.co.uk/template/_...mes/index.html

    and so far am here:
    http://www.web-user.info/arie/index.html

    The last test link.test 4 is to my webpage.It will not load the page as you can see.

    I will try and link to it as a regular link next but I don't know if it will load it into the div as the other links do.
    Thanks,

    Bud

  2. #2
    Join Date
    May 2012
    Location
    Hitchhiking the Galaxy
    Posts
    1,013
    Thanks
    47
    Thanked 139 Times in 139 Posts
    Blog Entries
    1

    Default

    The issue is that you've got this error:
    Origin http://www.web-user.info is not allowed by Access-Control-Allow-Origin.
    The issue and workaround are explained in detail here:
    http://stackoverflow.com/questions/9...not-allowed-by

    Another issue is the 403 error on the page:
    Failed to load resource: the server responded with a status of 403 (Forbidden) http://web-user.info.index/
    "Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program." - Linus Torvalds
    Anime Views Forums
    Bernie

  3. #3
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    1,297
    Thanks
    28
    Thanked 135 Times in 130 Posts
    Blog Entries
    28

    Default

    Hello Bud,
    Since you want to load the pages in an iframe, you'd better replace:
    Code:
    if(document.URL.substring(document.URL.lastIndexOf('/')+1,document.URL.length)!='index.html'){setTimeout("$('#test').load(document.URL.substring(document.URL.indexOf('?')+1,document.URL.length))",150)}
    with:
    Code:
    if(document.URL.substring(document.URL.lastIndexOf('/')+1,document.URL.length)!='index.html' && document.URL.substring(document.URL.lastIndexOf('/')+1,document.URL.length)!=''){$('#test').append('<iframe style="position:absolute; width:100%; height: 100%" frameborder="0" src="'+document.URL.substring(document.URL.indexOf('?')+1,document.URL.length)+'"</iframe>')}
    Also, the files you want to load shouldn't 'end' with 'index.html', not even with a '/', because of the first lines of the script. In your case, that last link would be:
    Code:
    <a href="index.html?http://web-user.info/search/business">TEST 4</a>
    I tested it: it works.

    Good luck,
    Arie.

  4. #4
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    1,297
    Thanks
    28
    Thanked 135 Times in 130 Posts
    Blog Entries
    28

    Default

    Hi Bud again,
    I looked at your site (the official one) in more detail. It's working OK, except that the address bar doesn't change when the visitor goes from one page to another. So the separate pages cannot be bookmarked.
    If you modify your site along the lines I indicated, this won't be a problem anymore.
    Arie.

  5. #5
    Join Date
    Jan 2011
    Location
    Southeastern CT
    Posts
    586
    Thanks
    41
    Thanked 27 Times in 27 Posts

    Default

    Okay,Arie,if you can spare a few minutes can you explain what these parts are for and what they do?

    Code:
    <script>
    $(document).ready(function() {
    if(document.URL.substring(document.URL.lastIndexOf('/')+1,document.URL.length)=='index.html'){window.location.replace('index.html?home.html')}
    if(document.URL.substring(document.URL.lastIndexOf('/')+1,document.URL.length)==''){window.location.replace('index.html?home.html')}
    if(document.URL.substring(document.URL.lastIndexOf('/')+1,document.URL.length)!='index.html' && document.URL.substring(document.URL.lastIndexOf('/')+1,document.URL.length)!=''){$('#test').append('<iframe style="position:absolute; width:100%; height: 100%" frameborder="0" src="'+document.URL.substring(document.URL.indexOf('?')+1,document.URL.length)+'"</iframe>')}
    });
    </script>
    It looks like there is four parts??

    ( I am not sure what I did wrong here)
    Last edited by ajfmrf; 12-10-2012 at 05:28 PM. Reason: error on the tag-code
    Thanks,

    Bud

  6. #6
    Join Date
    Jan 2011
    Location
    Southeastern CT
    Posts
    586
    Thanks
    41
    Thanked 27 Times in 27 Posts

    Default

    Okay,Arie,if you can spare a few minutes can you explain what these parts are for and what they do?
    Code:
    <script>
    $(document).ready(function() {
    if(document.URL.substring(document.URL.lastIndexOf('/')+1,document.URL.length)=='index.html'){window.location.replace('index.html?home.html')}
    if(document.URL.substring(document.URL.lastIndexOf('/')+1,document.URL.length)==''){window.location.replace('index.html?home.html')}
    if(document.URL.substring(document.URL.lastIndexOf('/')+1,document.URL.length)!='index.html' && document.URL.substring(document.URL.lastIndexOf('/')+1,document.URL.length)!=''){$('#test').append('<iframe style="position:absolute; width:100%; height: 100%" frameborder="0" src="'+document.URL.substring(document.URL.indexOf('?')+1,document.URL.length)+'"</iframe>')}
    });
    </script>
    It looks like there is four parts??

    byw here is what I have so far http://www.web-user.info/arie/index2.html
    Last edited by keyboard; 12-11-2012 at 08:22 PM. Reason: Just closed your code tag :)
    Thanks,

    Bud

  7. #7
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    1,297
    Thanks
    28
    Thanked 135 Times in 130 Posts
    Blog Entries
    28

    Default

    Hello Bud,

    The first line:
    Code:
    if(document.URL.substring(document.URL.lastIndexOf('/')+1,document.URL.length)=='index.html'){window.location.replace('index.html?home.html')}
    Meaning:
    If the part after the last '/' in the address bar simply is index.html, then replace index.html with index.html?home.html.
    This is needed to put your starting page (which used to be home.html) in the iframe right from the start. (But your changed things, see below).

    The second line:
    Code:
    if(document.URL.substring(document.URL.lastIndexOf('/')+1,document.URL.length)==''){window.location.replace('index.html?home.html')}
    Meaning:
    If there's nothing after the last '/' in the address bar, then do the same as above.
    This too is needed to put your starting page (which used to be home.html) in the iframe right from the start. (But your changed things, see below)

    The third line (there are only 3 lines!)
    Code:
    if(document.URL.substring(document.URL.lastIndexOf('/')+1,document.URL.length)!='index.html' && document.URL.substring(document.URL.lastIndexOf('/')+1,document.URL.length)!=''){$('#test').append('<iframe style="position:absolute; width:100%; height: 100%" frameborder="0" src="'+document.URL.substring(document.URL.indexOf('?')+1,document.URL.length)+'"></iframe>')}
    The if-part is a repetition of the 2 first lines, just to be sure. The relevant part is (using jQuery):
    Code:
    {$('#test').append('<iframe style="position:absolute; width:100%; height: 100%" frameborder="0" src="'+document.URL.substring(document.URL.indexOf('?')+1,document.URL.length)+'"></iframe>')}
    Meaning:
    Append to the div having id="test" a full size iframe that loads a file corresponding to: document.URL.substring(document.URL.indexOf('?')+1,document.URL.length).
    The string for this file represents what you put after '?' in the links, in your main file.
    By the way there was a typo in the last line. I had forgotten to put the red '>' above.

    Now, as to your second attempt: the reason why your http://www.web-user.info/arie/index2.html does not contain an iframed page right from the start is that your main page is called index2.html now (there's no index.html anymore). So in your code, you should replace all index.html with index2.html. Moreover, ?home.html does not make sense anymore, because in http://www.web-user.info/arie/index2.html there's no page called home.html. The part to the left of '?' should correspond with your main file (which is index2.html now), and the part after '?' should correspond with the name of a file you want to put in the iframe right from the start. It could be anything existing, like http://web-user.info/search/business.
    So in your new code, replace each index.html with index2.html, and replace your script with this:

    Code:
    <script>
    $(document).ready(function() {
    if(document.URL.substring(document.URL.lastIndexOf('/')+1,document.URL.length)=='index2.html'){window.location.replace('index2.html?http://web-user.info/search/business')}
    if(document.URL.substring(document.URL.lastIndexOf('/')+1,document.URL.length)==''){window.location.replace('index2.html?http://web-user.info/search/business')}
    if(document.URL.substring(document.URL.lastIndexOf('/')+1,document.URL.length)!='index2.html' && document.URL.substring(document.URL.lastIndexOf('/')+1,document.URL.length)!=''){$('#test').append('<iframe style="position:absolute; width:100%; height: 100%" frameborder="0" src="'+document.URL.substring(document.URL.indexOf('?')+1,document.URL.length)+'"></iframe>')}
    });
    </script>
    That should do it (hope there aren't typos anymore).

    Good luck,
    Arie.
    (It's not difficult, really; what is needed is just a little bit of perseverance).
    Last edited by molendijk; 12-10-2012 at 07:58 PM. Reason: Correction

  8. #8
    Join Date
    Jan 2011
    Location
    Southeastern CT
    Posts
    586
    Thanks
    41
    Thanked 27 Times in 27 Posts

    Default

    Arie,the index2.html is a test file so I will end up using the index.html when I make these changes to the site permenant.

    I am about to print this all out to read and make the required changes when I update the real page.I will wait tofr your response to this post for any relevant changes you may think need to be done.

    But more important I am going to watch the Patrots play the Texans.

    I am a big Patriots fan and am anxious for this game.

    I will get to this stuff probally tomorrow-
    Thanks,

    Bud

  9. #9
    Join Date
    Jan 2011
    Location
    Southeastern CT
    Posts
    586
    Thanks
    41
    Thanked 27 Times in 27 Posts

    Default

    Okay,I will be using the file as the index.html in my directory.So I think,if I understand correctly that instead of changing the script to account for the index2.html all I need to do is set it to start with the http://web-user.info/search/business as the page it has to start with that already loaded in the frame.

    Now my next question is a big one.I want to change the css to this to make it centered in any browser and also add a div on the top.something like what I have here now http://www.web-user.info/arie/index2.html .I am not used to using what you did for positioning things and will need to mess with things alot.lol

    I want to put my banner and the time date at the top like I have here:http://www.web-user.info/test.html

    So I am attempting to make those changes without messing things up.And if you knew my luck,you would wish me well(Murphy's law is my big brother and is always hanging around me-lol)
    Thanks,

    Bud

  10. #10
    Join Date
    Jan 2011
    Location
    Southeastern CT
    Posts
    586
    Thanks
    41
    Thanked 27 Times in 27 Posts

    Default

    Well, I messed things up somewhere and the pages no longer load into the frame.

    It did before but not now.
    http://www.web-user.info/arie/index2.html
    Thanks,

    Bud

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
  •