Discussion Forums  >  WebViews and HTML for Mobile

Replies: 14    Views: 97

Mr stuck
Android Fan
Profile
Posts: 974
Reg: Apr 09, 2012
Fife, Scotland
15,740
08/15/12 08:28 AM (13 years ago)

Html re direct toggle

I would like to make a html doc screen link to 2 different pages at different times of the day via a html redirect hosted on dropbox. I know I can do this by creating a .html file in dropbox and copy and paste the relevant redirect line of code depending on the time. However is it possible to put the 2 lines of redirect code in the same document and create a switch (text or image etc) that can simply be tapped to change the redirect. ie. log into dropbox and select the on/off Doc that controls the redirect. user is presented with a switch (either image or text) that states on or off. user then taps the switch and it changes the redirect code that is accessed by the html doc screen and sends it off to the relevant doc. hope this makes sense to someone who can maybe throw up some sample code . thanks
 
Fred@mySkylla com
Android Fan
Profile
Posts: 5259
Reg: Oct 03, 2011
location unknow...
62,560
like
08/15/12 08:37 AM (13 years ago)
This will redirect to mobile. <script type="text/javascript"> <!-- if (screen.width <= 699) { document.location = "http://[:(www.yoursite.com]"; } //--> </script>
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
08/15/12 09:11 AM (13 years ago)
Just to make sure I understand this: * User accesses an HTML page * That page has a link on it, the destination of which will be determined by the time of day. If it's before noon, for example, the user gets sent to Page A. If it's after noon, the user gets sent to Page B. Is that correct? Mark
 
Mr stuck
Android Fan
Profile
Posts: 974
Reg: Apr 09, 2012
Fife, Scotland
15,740
like
08/15/12 10:46 AM (13 years ago)
just to give a scenario. A shop wants an app. They want to accept orders during opening time. I create a html doc plugin that uses url for data. Depending in the time the shop is open or closed. if its open the app user is taken to an order form (I will host this on dropbox). if closed they will get a message advising not available at this time (html doc or image on photobucket etc). In the middle of this process is a html redirect that the shop keeper controls, so when they close the shop they simplysimply change the url in the redirect code. My question is. Can both lines of code be inserted into one html doc and a switch to toggle on/off instead of having to copy/paste the different url each time
 
Fred@mySkylla com
Android Fan
Profile
Posts: 5259
Reg: Oct 03, 2011
location unknow...
62,560
like
08/15/12 10:48 AM (13 years ago)
Just google "redirect based on time" and you'll find the code. Fred
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
08/15/12 10:50 AM (13 years ago)
 
Mr stuck
Android Fan
Profile
Posts: 974
Reg: Apr 09, 2012
Fife, Scotland
15,740
like
08/15/12 10:54 AM (13 years ago)
thanks Mark I will check that out. @Fred redirect based on time sounds like a good idea. the only flaw I thought about with that kind of technique is that there may be a time the shop can't open or is on holiday in which case that would not work unless there is some kind of workaround but that would mean shop keeper having to contact me to alter the redirect. I would prefer they had control over it.
 
Fred@mySkylla com
Android Fan
Profile
Posts: 5259
Reg: Oct 03, 2011
location unknow...
62,560
like
08/15/12 11:01 AM (13 years ago)
Just add an if/else with "Vacation, Sick, Just Too Lazy to Open Up" Option.
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
08/15/12 11:03 AM (13 years ago)
I totally see what you're trying to do (and it makes sense!), and Fred's suggestion won't quite address it. Let me think a bit about the best approach. For the general, everyday page where it's assumed it's business as usual, the time redirect info I provided should help. But let me think about how to toggle that page in general. Mark
 
Mr stuck
Android Fan
Profile
Posts: 974
Reg: Apr 09, 2012
Fife, Scotland
15,740
like
08/15/12 11:06 AM (13 years ago)
ha ha. thanks again Fred and Mark for your words of wisdom. will report back once I check out suggestions. sure I will find what I need.
 
Mr stuck
Android Fan
Profile
Posts: 974
Reg: Apr 09, 2012
Fife, Scotland
15,740
like
08/15/12 11:11 AM (13 years ago)
@Fred the "ha ha" was @your "just too lazy to open up" statement. @Mark thanks for offering to work out toggle the page. I look forward to your findings. thanks again guys.
 
Mr stuck
Android Fan
Profile
Posts: 974
Reg: Apr 09, 2012
Fife, Scotland
15,740
like
08/19/12 06:22 AM (13 years ago)
@GoNorthWest did you have time to look into this. would be interested in any findings. thanks
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
08/19/12 10:25 AM (13 years ago)
Not yet, but thanks for the prod. Will see what I can do today. Mark
 
Mr stuck
Android Fan
Profile
Posts: 974
Reg: Apr 09, 2012
Fife, Scotland
15,740
like
08/19/12 10:30 AM (13 years ago)
No rush its just the final piece of the jigsaw in an app I'm building which will probably take a while to finish yet. thanks again!
 
Mr stuck
Android Fan
Profile
Posts: 974
Reg: Apr 09, 2012
Fife, Scotland
15,740
like
08/31/12 01:36 AM (13 years ago)
@GoNorthWest did you ever get a chance to have a go at this? Would very appreciative if you do. thanks again.
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.