redirectng移动友好网站到桌面客户端

时间:2016-10-19 03:18:13

标签: jquery html css jquery-mobile mobile

我创建了两个截然不同的网站。一个用于桌面查看,一个用于小型移动。全在记事本中。我使用脚本将桌面重定向到移动设备,如下所示;

  if (screen.width <= 760) {
    window.location = "http://m.website.ca/page.htm";
  }

这确保了桌面版本在ipad而不是移动版本中显示。我尝试使用相同的脚本,在移动页面中最大宽度低至500,以重定向到桌面版本,并创建一个循环,从而既不显示页面,而是保持刷新,即;桌面到移动,移动到桌面。

现在,我遇到的问题是,如果您在桌面中键入m.website.ca地址,它们就会显示出来。我不希望别人看到移动地址。 为了能够无缝地运行,有人在社交媒体上接收与m的链接。地址,如果桌面客户端正在使用,我试图让它们加载到桌面。

1 个答案:

答案 0 :(得分:2)

您必须通过在重定向之前检查位置的主机名来确保您访问错误的网站:

nasm boot/arch/x86/bootsect.asm -f bin -o boot/arch/x86/bootsect.bin
nasm boot/arch/x86/kernel_entry.asm -f elf -o boot/arch/x86/kernel_entry.o
/Users/JacoboSoffer/i386elfgcc/bin/i386-elf-gcc -g -ffreestanding -Wall -Wextra -fno-exceptions -m32 -c fenix/kernel/kernel.c -o fenix/kernel/kernel.o
nasm cpu/interrupt.asm -f elf -o cpu/interrupt.o
/Users/JacoboSoffer/i386elfgcc/bin/i386-elf-gcc -g -ffreestanding -Wall -Wextra -fno-exceptions -m32 -c drivers/keyboard.c -o drivers/keyboard.o
/Users/JacoboSoffer/i386elfgcc/bin/i386-elf-gcc -g -ffreestanding -Wall -Wextra -fno-exceptions -m32 -c drivers/screen.c -o drivers/screen.o
/Users/JacoboSoffer/i386elfgcc/bin/i386-elf-gcc -g -ffreestanding -Wall -Wextra -fno-exceptions -m32 -c cpu/idt.c -o cpu/idt.o
/Users/JacoboSoffer/i386elfgcc/bin/i386-elf-gcc -g -ffreestanding -Wall -Wextra -fno-exceptions -m32 -c cpu/isr.c -o cpu/isr.o
/Users/JacoboSoffer/i386elfgcc/bin/i386-elf-gcc -g -ffreestanding -Wall -Wextra -fno-exceptions -m32 -c cpu/ports.c -o cpu/ports.o
/Users/JacoboSoffer/i386elfgcc/bin/i386-elf-gcc -g -ffreestanding -Wall -Wextra -fno-exceptions -m32 -c cpu/timer.c -o cpu/timer.o
cpu/timer.c: In function 'timer_callback':
cpu/timer.c:15:5: warning: implicit declaration of function 'int_to_ascii' [-Wimplicit-function-declaration]
     int_to_ascii(tick, tick_ascii);
     ^~~~~~~~~~~~
cpu/timer.c:10:40: warning: unused parameter 'regs' [-Wunused-parameter]
 static void timer_callback(registers_t regs) {
                                        ^~~~
cpu/timer.c: In function 'init_timer':
cpu/timer.c:22:38: warning: passing argument 2 of 'register_interrupt_handler' from incompatible pointer type [-Wincompatible-pointer-types]
     register_interrupt_handler(IRQ0, timer_callback);
                                      ^~~~~~~~~~~~~~
In file included from cpu/timer.c:6:0:
cpu/isr.h:93:6: note: expected 'isr_t {aka void (*)(struct <anonymous> *)}' but argument is of type 'void (*)(registers_t) {aka void (*)(struct <anonymous>)}'
 void register_interrupt_handler(uint8_t n, isr_t handler);
      ^~~~~~~~~~~~~~~~~~~~~~~~~~
cpu/timer.c:29:5: warning: implicit declaration of function 'port_byte_out' [-Wimplicit-function-declaration]
     port_byte_out(0x43, 0x36); /* Command port */
     ^~~~~~~~~~~~~
/Users/JacoboSoffer/i386elfgcc/bin/i386-elf-gcc -g -ffreestanding -Wall -Wextra -fno-exceptions -m32 -c libc/mem.c -o libc/mem.o
/Users/JacoboSoffer/i386elfgcc/bin/i386-elf-gcc -g -ffreestanding -Wall -Wextra -fno-exceptions -m32 -c libc/string.c -o libc/string.o
/Users/JacoboSoffer/i386elfgcc/i386-elf/bin/ld  -o kernel.bin -Ttext 0x1000 boot/arch/x86/kernel_entry.o fenix/kernel/kernel.o cpu/interrupt.o drivers/keyboard.o drivers/screen.o cpu/idt.o cpu/isr.o cpu/ports.o cpu/timer.o libc/mem.o libc/string.o --oformat binary
drivers/keyboard.o:(.data+0x0): multiple definition of `sc_name'
fenix/kernel/kernel.o:(.data+0x0): first defined here
drivers/keyboard.o:(.rodata+0xc0): multiple definition of `sc_ascii'
fenix/kernel/kernel.o:(.rodata+0xc0): first defined here
drivers/keyboard.o: In function `init_keyboard':
/Users/JacoboSoffer/Desktop/Elemental/fenix copy/drivers/keyboard.c:50: multiple definition of `init_keyboard'
fenix/kernel/kernel.o:/Users/JacoboSoffer/Desktop/Elemental/fenix copy/fenix/kernel/../../drivers/keyboard.c:50: first defined here
make: *** [kernel.bin] Error 1

否则,你会得到一个无限循环。

相关问题