Results 1 to 3 of 3

Pop-up Window and vbseo problem

This is a discussion on Pop-up Window and vbseo problem within the Template Modifications forums, part of the vBulletin SEO Discussion category; I'm not really good with javascript and need help with a problem. I've creating a pop-up window that goes to ...

  1. #1
    Junior Member
    Real Name
    Unknown
    Join Date
    Sep 2009
    Posts
    2
    Liked
    0 times

    Pop-up Window and vbseo problem

    I'm not really good with javascript and need help with a problem. I've creating a pop-up window that goes to another site but sends the url it's coming from in the url it's going to.

    Ok here's what I have if that's confusing.
    HTML Code:
    <head>
    <script type="text/javascript">
    function popupwin(url) 
    {
     var width  = 650;
     var height = 250;
     var left   = (screen.width  - width)/2;
     var top    = (screen.height - height)/2;
     var params = 'width='+width+', height='+height;
     params += ', top='+top+', left='+left;
     params += ', scrollbars=1';
     newwin=window.open(url,'popupwin', params);
     if (window.focus) {newwin.focus()}
     return false;
    }
    </script>
    </head>
    <body>
    <a href="javascript: void(0)" onClick="popupwin('http://example.com/check.php?id=http://$_SERVER[SERVER_NAME]$_SERVER[REQUEST_URI]'); return false;">Centered popup window</a>
    </body>
    Now that above code works fine in most cases and on most sites. The problem is that one forum I've tried it on has vbseo which means the php comand $_SERVER[REQUEST_URI] isn't the same that's in the address bar. Instead of showing
    Code:
    http://example.com/check.php?id=http://sitename.com/forum/main-forum/1-test-post-title-some-list.html
    it's showing
    Code:
    http://example.com/check.php?id=http://sitename.com/forum/showthread.php?p=1
    After Googling I know that document.write(location.href) will give me the exact url of the seo url as it appears in the address bar which may help. Can anyone show me how to combine document.write(location.href) with my code or offer a suitable alternative to fix the problem?

    To clarify the above code works on a regular vb forum just not when vbseo is added.

    Thanks in advance.

  2. #2
    vBSEO Staff Brian Cummiskey's Avatar
    Real Name
    Brian Cummiskey
    Join Date
    Jul 2009
    Location
    btwn NYC and Boston
    Posts
    12,782
    Liked
    648 times
    Blog Entries
    2
    Code:
    this.location.href
    should be all you need


    HTML Code:
    <a href="javascript: void(0)" onclick="popupwin('http://example.com/check.php?id='+ this.location.href); return false;">Centered popup window</a>
    Brian Cummiskey / Crawlability Inc.
    vBSEO 3.6.0 GOLD Released!
    Unveiling the NEW vBSEO Sitemap Generator 3.0. - available NOW for vBSEO Customers!


  3. #3
    Junior Member
    Real Name
    Unknown
    Join Date
    Sep 2009
    Posts
    2
    Liked
    0 times
    Thank you that fixed the problem. It was the 'this' bit I was missing :P

    This is now solved!

Similar Threads

  1. Float in Registration Window
    By sGroup in forum Off-Topic & Chit Chat
    Replies: 1
    Last Post: 03-24-2009, 01:48 PM
  2. All internal links open in new window
    By dingo in forum Troubleshooting
    Replies: 2
    Last Post: 12-12-2008, 08:23 AM
  3. Custom Redirects Window Size
    By PromotePoker in forum vBSEO Features Archive
    Replies: 3
    Last Post: 02-29-2008, 09:50 PM
  4. Will Vbseo work on server window?
    By dinhchi.com in forum Pre-Sales Questions
    Replies: 3
    Last Post: 12-07-2007, 11:32 AM
  5. window.print()
    By Steel in forum Deutsch
    Replies: 2
    Last Post: 04-14-2006, 05:18 PM

Posting Permissions

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