The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Switch accounts widget doesn't work

3 posters

Go down

Solved Switch accounts widget doesn't work

Post by the_rocketeer May 10th 2017, 5:11 pm

Hey guys!

It's me, again
I made switch accounts widget on my forum and it worked perfectly. Than I put it in my homepage message using <iframe> (because I want it there) and now it does nothing when i try to switch account. Do you have any idea why?

These are my codes:

Homepage message
Code:
<iframe style="width: 200px; height: 200px;" src="http://love-you-hogwarts.forumy.biz/h2-switch-account" scrolling="no" frameborder="0"> </iframe>

Widget
Code:
 
<div id="accountswitch">
                     <script type="text/javascript">
        function switch_accounts() {
        jQuery.get(document.getElementById('logout').href, function() {
        jQuery.post('/login', 'login=1&username='+document.getElementById('switch_uname').value+'&password='+document.getElementById('switch_pass').value, function () {
        window.parent.location.reload();
        });
        });
        }
        </script>                 
   <div style="margin-top:20px">
                                 
      <center>
                     <span class="accountswitchtext">Switch account  </span>           
      </center>
                                                                                             
      <div class="accountswitchhr">
                                  
      </div>
                                                                                                 
      <div class="accountswitchbg">
                       Username:<br />  <input id="switch_uname" type="text" /> <br /> <br />        Password:<br />  <input id="switch_pass" type="password" /> <br /> <br />                   
         <center>
                        <input type="button" value="Switch" onclick="switch_accounts();" />           
         </center>
                                                                                                    
      </div>
                               
   </div>
                            
</div>

Thank you in advance for any help you can provide! Good
the_rocketeer
the_rocketeer
Forumember

Other / Decline to state Posts : 88
Reputation : 4
Language : English
Location : Europe

http://love-you-hogwarts.bulgarianforum.net/

Back to top Go down

Solved Re: Switch accounts widget doesn't work

Post by SWS May 10th 2017, 5:13 pm

Yeah, I got a hunch here. Because you're running it in an iframe, there's no connection to the FM DB, so that's why... unfortunately.
SWS
SWS
Forumember

Female Posts : 80
Reputation : 7
Language : US English / Dutch
Location : 35 miles NWW of Los Angeles Airport (LAX) when able, currently living 1 mile SWW of Amsterdam Airport (AMS).

http://www.friendcodes.nl

Back to top Go down

Solved Re: Switch accounts widget doesn't work

Post by the_rocketeer May 10th 2017, 5:32 pm

Hey SWS! bye

Well, sounds pretty logical but If there's no connection to the FM how it's possible that recent topics work? I used the same way to move them there. Sorry for asking nonsenses, I'm really confused scratch
the_rocketeer
the_rocketeer
Forumember

Other / Decline to state Posts : 88
Reputation : 4
Language : English
Location : Europe

http://love-you-hogwarts.bulgarianforum.net/

Back to top Go down

Solved Re: Switch accounts widget doesn't work

Post by SWS May 12th 2017, 12:17 am

An iframe is used to display a web page within a web page. Since the other widgets, like 'Recent Topics' are part of the main web page, they will work. It's a bit difficult for me to explain in brief, but that's most likely causing your iframe failing to act the way you want it to. That's my best guess anyway. The only reason I can come up with for anyone to use an iframe is to frame external sites, links and scripts on a site, like streaming media, weather updates, live maps, flight tracking, that sort of stuff.
SWS
SWS
Forumember

Female Posts : 80
Reputation : 7
Language : US English / Dutch
Location : 35 miles NWW of Los Angeles Airport (LAX) when able, currently living 1 mile SWW of Amsterdam Airport (AMS).

http://www.friendcodes.nl

Back to top Go down

Solved Re: Switch accounts widget doesn't work

Post by the_rocketeer May 13th 2017, 6:49 am

Ooookay, I tried to put the widget code in homepage message and it worked. The only thing left to do is set the position with css. cheers

SWS, thanks a lot for your kind, detailed and informative answer!

Problem and topic solved!

the_rocketeer
the_rocketeer
Forumember

Other / Decline to state Posts : 88
Reputation : 4
Language : English
Location : Europe

http://love-you-hogwarts.bulgarianforum.net/

Back to top Go down

Solved Re: Switch accounts widget doesn't work

Post by Ape May 13th 2017, 5:19 pm

Problem solved & topic archived.
Please read our forum rules: ESF General Rules


Switch accounts widget doesn't work Left1212Switch accounts widget doesn't work Center11Switch accounts widget doesn't work Right112
Switch accounts widget doesn't work Ape_b110
Switch accounts widget doesn't work Ape1010
Ape
Ape
Administrator
Administrator

Male Posts : 19435
Reputation : 2010
Language : fluent in dork / mumbojumbo & English haha

http://chatworld.forumotion.co.uk/

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum