Running my simulator on a wordpress site

17 replies
I have a simulator at Iphone mobile simulator emulator

If I add the script on a server that runs Wordpress the simulator still works but I cannot send a url to it.

So for example on the mobilesimulator.info I can send a url like this.

Iphone mobile simulator emulator

However when I try to do the same thing on a site with wordpress it blocks

So I am thinking I need to add something to the htaccess to allow it to run.

Can you help.

Q
#running #simulator #site #wordpress
  • Profile picture of the author wcardinal
    do you run it in an iframe in a post? It seems to work fine on this site:

    tweakingwp.com/mobile-phone-simulator
    Signature

    {{ DiscussionBoard.errors[4242910].message }}
  • Profile picture of the author Quentin
    No as you cannot post a url to it.

    The whole purpose of my simulator is to be able to send a url to the simulator so the customer sees their site in it.

    Code:
    http://mobilesimulator.info/?url=http://keymobi.info/nick/fitbits
    Quentin
    {{ DiscussionBoard.errors[4242943].message }}
  • Profile picture of the author johnnyN
    yeah wordpress will block any url parameters if you are using permalinks.

    if you are able to turn off permalinks on your blog then that would be the easy way.

    another way would be to create a plugin to allow the parameter.

    create a file like urlallow.php (you will upload to your plugins).
    add the following code to that page

    <?php
    /* Plugin Name: Parameter
    Plugin URI: Webopius - Web design | Project Management | Technology Management | SEO | Graphic Design | E-Commerce | Content Management - Richmond, Surrey, West London, UK
    Description: A plugin to allow parameters to be passed in the URL and recognized by WordPress
    Author: Adam Boyse
    Version: 1.0
    Author URI: Webopius - Web design | Project Management | Technology Management | SEO | Graphic Design | E-Commerce | Content Management - Richmond, Surrey, West London, UK
    */
    add_filter('query_vars', 'parameter_queryvars' );

    function parameter_queryvars( $qvars )
    {
    $qvars[] = 'url';
    return $qvars;
    }
    ?>

    that should work (note the $qvars[] = 'url'; line allows the parameter called url
    I found the solution here
    WordPress › Support ยป Passing variables using the permalink structure
    {{ DiscussionBoard.errors[4260829].message }}
  • Profile picture of the author profitableblog
    I understand this is an old thread but I don't see a solution and have the same question - does anyone have a mobile phone simulator script suggestions? We'd like to have our independent sales people use our website to show clients how their websites look on mobile phones.

    Our company sells Google Places services so any suggestions would be great because we would like the exposure on our website for this type of service.
    Signature

    You Sell Google Places Services - We Deliver The Services For You. PM Me For Details.

    {{ DiscussionBoard.errors[5413811].message }}
    • Profile picture of the author 4webmaster
      Originally Posted by profitableblog View Post

      I understand this is an old thread but I don't see a solution and have the same question - does anyone have a mobile phone simulator script suggestions? We'd like to have our independent sales people use our website to show clients how their websites look on mobile phones.

      Our company sells Google Places services so any suggestions would be great because we would like the exposure on our website for this type of service.
      We do have a mobile simulator that runs under Wordpress.
      {{ DiscussionBoard.errors[6705492].message }}
  • Profile picture of the author anconsoft
    I can help you building a plugin or adding an adjustment to your theme to allow that. Let me know if you want my help, PM me.
    {{ DiscussionBoard.errors[6705575].message }}
  • Profile picture of the author Terry Jett
    Quentin, did you ever get this solved so it works along side a wordpress install in sub-directory? Figure it has to do with the .htaccess file, but cannot figure it out

    Surprised someone has not already built a plugin to incorporate this into a WP site so you can use the ?url=

    Terry
    {{ DiscussionBoard.errors[6894464].message }}
  • Profile picture of the author Quentin
    No never got it sorted Terry

    Q
    {{ DiscussionBoard.errors[6896099].message }}
    • Profile picture of the author stuartcryan
      If you are still interested, you should be able to get around it with something like this modification below in your htaccess file:

      <IfModule mod_rewrite.c>
      RewriteEngine On
      RewriteBase /blog/
      RewriteRule ^index\.php$ - [L]
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteCond %{QUERY_STRING} !(^|&)options=com_wrapper($|&)
      RewriteRule . /blog/index.php [L]
      </IfModule>

      note that I have an additional line stating:
      RewriteCond %{QUERY_STRING} !(^|&)options=com_wrapper($|&)

      what you can do is add additional RewriteCond lines that will stop it doing the redirect.

      So you could add a line:
      RewriteCond %{REQUEST_URI} !"/folderToExclude/" [OR] (I think I have that syntax correct *fingers crossed*) and the redirect should not happen.

      Let me know how you go and I might be able to toy with it a bit more if that doesn't work.
      Stuart
      {{ DiscussionBoard.errors[6896779].message }}
  • Profile picture of the author Terry Jett
    Thanks Stuart! That did the trick. Can now use in sub-directory.

    Now if I could just get the thing to work in a sub-domain (which is totally different than the WP issue). When adding the ?url= while in sub-domain folder it produces 500 error.

    Not a biggie though. Just being able to use in WP directory is a big help.

    Thank you again Stuart,

    Terry
    {{ DiscussionBoard.errors[6898445].message }}
  • Profile picture of the author Quentin
    There is a file in there called get url which you will need to edit if you are going to put it in a sub directory

    Q
    {{ DiscussionBoard.errors[6898526].message }}
    • Profile picture of the author Terry Jett
      Originally Posted by Quentin View Post

      There is a file in there called get url which you will need to edit if you are going to put it in a sub directory

      Q
      Thanks Q. Got it working in sub-directory without issues with Stuart's code.

      Was talking about a subdomain, like m.google.com

      Did look at the geturl.js and also the call to it from the HTML files. Tried some changes but was unsuccessful.
      {{ DiscussionBoard.errors[6898585].message }}
  • Profile picture of the author stuartcryan
    Hi Terry,
    Tried to PM you back haha but unfortunately I am too nooby to be able to (have to have 50 posts).

    Are you please able to PM me the HTAccess rules you have in place (so I can have a bit of a tinkle on my own server).
    Cheers
    Stuart
    {{ DiscussionBoard.errors[6901369].message }}
    • Profile picture of the author Terry Jett
      Originally Posted by stuartcryan View Post

      Hi Terry,
      Tried to PM you back haha but unfortunately I am too nooby to be able to (have to have 50 posts).

      Are you please able to PM me the HTAccess rules you have in place (so I can have a bit of a tinkle on my own server).
      Cheers
      Stuart
      Hey Stuart! Sorry for delay man. Holiday weekend here and last one for the summer, so on the go

      I will just post the .htaccess here. That way everyone can see:
      Code:
      <IfModule mod_rewrite.c>
      RewriteEngine On
      RewriteBase /
      RewriteRule ^index.php$ - [L]
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteCond %{QUERY_STRING} !(^|&)options=com_wrapper($|&)
      RewriteRule . /index.php [L]
      </IfModule>
      Appreciate your help very much. Will be on tablet rest of weekend but might be slow to respond.
      {{ DiscussionBoard.errors[6905373].message }}
      • Profile picture of the author stuartcryan
        Hey Terry, give this a go instead:
        Code:
        <IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteBase /
        RewriteRule ^index.php$ - [L]
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteCond %{REQUEST_URI} !^/free-simulator/.*
        RewriteRule . /index.php [L]
        </IfModule>
        Let me know how that goes?
        Stu
        {{ DiscussionBoard.errors[6908202].message }}
        • Profile picture of the author Terry Jett
          Thanks again Stuart.

          Did a quick test but did not allow the ?url=

          Sends to the 404 page. But staying on boat and using tablet, which is hard to work from. Not sure my text editor/ftp is not changing things. Will be back in my home office on Monday afternoon and try from real computer

          I appreciate your help!

          Terry
          {{ DiscussionBoard.errors[6908733].message }}
  • Profile picture of the author stuartcryan
    #Sigh... theres some irony MWAHAHAHA noobish enough to accidentally double post . (I maintain I hit submit, it presented me with a "preview" and then I submitted

    #MyBad
    {{ DiscussionBoard.errors[6901375].message }}

Trending Topics